ATUM REST API

Inventories

ATUM Multi-Inventory

The ATUM inventories API allows you to create, view, update, and delete inventories.

Inventory properties

AttributeTypeDescription
idintegerUnique identifier for the inventory. read-only
product_idintegerThe product ID this inventory is linked to. read-only
namestringThe inventory name. It must be unique within the product's inventories. mandatory
priorityintegerThe priority index within the list of the product inventories' list.
is_mainbooleanWhether the current inventory is the main inventory. Only one Main Inventory is allowed per product.
inventory_datedate-timeThe date the inventory was created, as GMT.
lotstringThe LOT/BATCH number.
write_offbooleanWhether the current inventory was marked as 'write-off'.
regionarrayIf the region restriction mode is enabled, it'll show the list of countries or shipping zones linked to the inventory. In countries mode, it's a list of country codes (__atum_rest_of_world__ stands for all the other countries). In shipping zones mode, it's returned as an object with the zone names keyed by zone ID, and it accepts zone names or IDs when writing (0 stands for the rest of the world).
locationarrayATUM Location(s) linked to the inventory. It's returned as an object with the location slugs keyed by term ID, and it accepts location term IDs or slugs when writing.
bbe_datedate-timeThe Best-Before-Expiry date for the inventory, as GMT.
expiry_thresholdintegerThe expiry threshold (in days) before the BBE date when the product should go out of stock. When it's 0, the default expiry threshold from the Multi-Inventory settings is used. It's reset to 0 if the inventory has no BBE date.
inbound_stocknumberInventory's inbound stock. read-only
stock_on_holdnumberInventory's stock on hold. read-only
sold_todaynumberInventory units sold today. read-only
sales_last_daysnumberInventory sales the last 14 days. read-only
reserved_stocknumberInventory stock set as 'reserved stock' within Inventory Logs. read-only
customer_returnsnumberInventory stock set as 'customer returns' within Inventory Logs. read-only
warehouse_damagenumberStock set as 'warehouse damage' within Inventory Logs. read-only
lost_in_postnumberStock set as 'lost in post' within Inventory Logs. read-only
other_logsnumberStock set as 'other' within Inventory Logs. read-only
out_stock_daysintegerThe number of days that the product is Out of stock. read-only
lost_salesnumberProduct lost sales. read-only
update_datedate-timeLast date when the inventory data was calculated and saved for this product, as GMT.
meta_dataobjectMeta data. See Inventories - Meta data properties

The calculated properties (from inbound_stock to update_date) are only returned in the view context. The create, update, delete and batch responses use the edit context, so they don't include them.

Inventories - Meta data properties

AttributeTypeDescription
skustringInventory's SKU.
manage_stockbooleanWhether the stock is being managed for the inventory.
stock_quantitynumberInventory's stock amount.
backordersstringWhether the backorders are allowed. Options: no, notify and yes.
stock_statusstringInventory's stock status. Options: instock, outofstock and onbackorder.
supplier_idintegerInventory supplier's ID.
supplier_skustringInventory supplier's SKU.
barcodestringInventory barcode.
sold_individuallybooleanWhether the inventory should be sold individually.
out_stock_thresholdnumberInventory's out of stock threshold.
low_stock_thresholdnumberInventory's low stock threshold.
purchase_pricenumberInventory's purchase price.
pricenumberInventory's price.
regular_pricenumberInventory's regular price.
sale_pricenumberInventory's sale price.
date_on_sale_fromdate-timeThe date when starts the sale price, as GMT.
date_on_sale_todate-timeThe date when ends the sale price, as GMT.
out_stock_datedate-timeThe date when the inventory run out of stock, as GMT.
expired_stocknumberThe expired stock amount.
is_expiredbooleanWhether the inventory has expired.

Create an inventory

This API helps you to create a new inventory for the specified product.

HTTP request

POST/wp-json/wc/v3/products/<product_id>/inventories

Example of how to create a product inventory

curl -X POST https://example.com/wp-json/wc/v3/products/507/inventories \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
    "name": "Inventory 1",
    "is_main": false,
    "meta_data": {
        "sku": "TEST1",
        "manage_stock": true,
        "stock_quantity": 10,
        "backorders": "no",
        "stock_status": "instock",
        "purchase_price": 9.5,
        "price": 12,
        "regular_price": 12
    } 
}'
JSON response example
{
    "id": 208,
    "product_id": 507,
    "name": "Inventory 1",
    "priority": 0,
    "is_main": false,
    "inventory_date": "2020-09-01T09:16:19",
    "lot": "",
    "write_off": false,
    "region": [],
    "location": [],
    "bbe_date": null,
    "expiry_threshold": 0,
    "meta_data": {
        "sku": "TEST1",
        "manage_stock": true,
        "stock_quantity": 10,
        "backorders": "no",
        "stock_status": "instock",
        "supplier_id": "",
        "supplier_sku": "",
        "barcode": "",
        "sold_individually": false,
        "out_stock_threshold": "",
        "low_stock_threshold": "",
        "purchase_price": "9.5",
        "price": "12",
        "regular_price": "12",
        "sale_price": "",
        "date_on_sale_from": null,
        "date_on_sale_to": null,
        "out_stock_date": null,
        "expired_stock": null,
        "is_expired": false
    },
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
            }
        ],
        "up": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507"
            }
        ]
    }
}

Retrieve an inventory

This API lets you retrieve an inventory by ID. The inventory must belong to the product specified in the URL.

HTTP request

GET/wp-json/wc/v3/products/<product_id>/inventories/<id>
curl https://example.com/wp-json/wc/v3/products/507/inventories/208 \
	-u consumer_key:consumer_secret
JSON response example
{
    "id": 208,
    "product_id": 507,
    "name": "Inventory 1",
    "priority": 0,
    "is_main": false,
    "inventory_date": "2020-09-01T09:16:19",
    "lot": "",
    "write_off": false,
    "region": [],
    "location": [],
    "bbe_date": null,
    "expiry_threshold": 0,
    "inbound_stock": "0",
    "stock_on_hold": 0,
    "sold_today": 0,
    "sales_last_days": 0,
    "reserved_stock": 0,
    "customer_returns": 0,
    "warehouse_damage": 0,
    "lost_in_post": 0,
    "other_logs": 0,
    "out_stock_days": 0,
    "lost_sales": 0,
    "update_date": "2020-09-01T09:16:19",
    "meta_data": {
        "sku": "TEST1",
        "manage_stock": true,
        "stock_quantity": 10,
        "backorders": "no",
        "stock_status": "instock",
        "supplier_id": "",
        "supplier_sku": "",
        "barcode": "",
        "sold_individually": false,
        "out_stock_threshold": "",
        "low_stock_threshold": "",
        "purchase_price": "9.5",
        "price": "12",
        "regular_price": "12",
        "sale_price": "",
        "date_on_sale_from": null,
        "date_on_sale_to": null,
        "out_stock_date": null,
        "expired_stock": null,
        "is_expired": false
    },
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
            }
        ],
        "up": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507"
            }
        ]
    }
}

List all the product inventories

This API lets you retrieve all the inventories for the specified product.

This endpoint isn't paginated: it returns all the product inventories that match the filters, sorted by priority by default.

HTTP request

GET/wp-json/wc/v3/products/<product_id>/inventories
curl https://example.com/wp-json/wc/v3/products/507/inventories \
	-u consumer_key:consumer_secret
JSON response example
[
    {
        "id": "55",
        "product_id": 507,
        "name": "Main Inventory",
        "priority": 0,
        "is_main": true,
        "inventory_date": "2019-09-11T10:26:00",
        "lot": "",
        "write_off": false,
        "region": [],
        "location": {
            "50": "madrid"
        },
        "bbe_date": null,
        "expiry_threshold": 0,
        "inbound_stock": "1",
        "stock_on_hold": 4,
        "sold_today": 0,
        "sales_last_days": 0,
        "reserved_stock": 1,
        "customer_returns": 0,
        "warehouse_damage": 0,
        "lost_in_post": 0,
        "other_logs": 0,
        "out_stock_days": 0,
        "lost_sales": 0,
        "update_date": "2020-08-31T07:27:30",
        "meta_data": {
            "sku": "",
            "manage_stock": true,
            "stock_quantity": 22,
            "backorders": "no",
            "stock_status": "instock",
            "supplier_id": 399,
            "supplier_sku": "CRYPTO",
            "barcode": "INVBARKJHOIHO",
            "sold_individually": false,
            "out_stock_threshold": "",
            "low_stock_threshold": "",
            "purchase_price": "2",
            "price": "5.32",
            "regular_price": "5.32",
            "sale_price": "",
            "date_on_sale_from": null,
            "date_on_sale_to": null,
            "out_stock_date": null,
            "expired_stock": null,
            "is_expired": false
        },
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/507/inventories/55"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                }
            ],
            "up": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/507"
                }
            ]
        }
    },
    {
        "id": "208",
        "product_id": 507,
        "name": "Inventory 1",
        "priority": 0,
        "is_main": false,
        "inventory_date": "2020-09-01T09:16:19",
        "lot": "",
        "write_off": false,
        "region": [],
        "location": [],
        "bbe_date": null,
        "expiry_threshold": 0,
        "inbound_stock": "0",
        "stock_on_hold": 0,
        "sold_today": 0,
        "sales_last_days": 0,
        "reserved_stock": 0,
        "customer_returns": 0,
        "warehouse_damage": 0,
        "lost_in_post": 0,
        "other_logs": 0,
        "out_stock_days": 0,
        "lost_sales": 0,
        "update_date": "2020-09-01T09:16:19",
        "meta_data": {
            "sku": "TEST1",
            "manage_stock": true,
            "stock_quantity": 10,
            "backorders": "no",
            "stock_status": "instock",
            "supplier_id": "",
            "supplier_sku": "",
            "barcode": "",
            "sold_individually": false,
            "out_stock_threshold": "",
            "low_stock_threshold": "",
            "purchase_price": "9.5",
            "price": "12",
            "regular_price": "12",
            "sale_price": "",
            "date_on_sale_from": null,
            "date_on_sale_to": null,
            "out_stock_date": null,
            "expired_stock": null,
            "is_expired": false
        },
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                }
            ],
            "up": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/507"
                }
            ]
        }
    }
]

Available parameters

ParameterTypeDescription
contextstringScope under which the request is made; determines fields present in response. Options: view and edit.
afterstringLimit response to resources created after a given ISO8601 compliant date.
beforestringLimit response to resources created before a given ISO8601 compliant date.
excludearrayEnsure result set excludes specific IDs.
includearrayLimit result set to specific IDs.
offsetintegerOffset the result set by a specific number of items.
orderstringOrder sort attribute ascending or descending. Options: asc and desc. Default is asc.
orderbystringSort collection by object attribute. Options: priority, inventory_date, id, name and bbe_date. Default is priority.
namestringLimit result set to inventories with a specific name.
exclude_write_offbooleanExclude from result set the inventories that were marked as 'write off'. Default is true.
lotstringLimit result set to inventories with the specified LOT/BATCH number.
barcodestringLimit result set to inventories with the specified barcode.
countrystringIf the country restriction mode is enabled, limit the result set to inventories linked to the specified country code.
shipping_zonestringIf the shipping zone restriction mode is enabled, limit the result set to inventories linked to the specified shipping zone name.
locationstringLimit the result set to inventories linked to the specified location. It accepts a location term ID or a location name.

The country and shipping_zone parameters are only available when the matching region restriction mode is enabled in the Multi-Inventory settings.

List all the inventories

This API lets you retrieve all the inventories registered on the system, from all the products. The results are paginated.

HTTP request

GET/wp-json/wc/v3/atum/inventories
curl https://example.com/wp-json/wc/v3/atum/inventories \
	-u consumer_key:consumer_secret
JSON response example
[
    {
        "id": "3",
        "product_id": 90,
        "name": "Custom Inventory",
        "priority": 5,
        "is_main": false,
        "inventory_date": "2018-10-25T10:10:00",
        "lot": "",
        "write_off": false,
        "region": [],
        "location": [],
        "bbe_date": null,
        "expiry_threshold": 0,
        "inbound_stock": "0",
        "stock_on_hold": 17,
        "sold_today": 0,
        "sales_last_days": 0,
        "reserved_stock": 0,
        "customer_returns": 0,
        "warehouse_damage": 0,
        "lost_in_post": 0,
        "other_logs": 0,
        "out_stock_days": 0,
        "lost_sales": 0,
        "update_date": "2020-10-05T07:20:52",
        "meta_data": {
            "sku": "WOO3",
            "manage_stock": true,
            "stock_quantity": 3,
            "backorders": "no",
            "stock_status": "instock",
            "supplier_id": 399,
            "supplier_sku": "SUPSK1",
            "barcode": "AAAAAABBBBBB",
            "sold_individually": false,
            "out_stock_threshold": "",
            "low_stock_threshold": "",
            "purchase_price": "18.9",
            "price": "15.7",
            "regular_price": "15.7",
            "sale_price": "",
            "date_on_sale_from": null,
            "date_on_sale_to": null,
            "out_stock_date": null,
            "expired_stock": null,
            "is_expired": false
        },
        "_links": {
            "self": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/90/inventories/3"
                }
            ],
            "collection": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/90/inventories"
                }
            ],
            "up": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/90"
                }
            ]
        }
    },
    {
        "id": "7",
        "product_id": 83,
        "name": "Main Inventory",
        "priority": 0,
        "is_main": true,
        "inventory_date": "2018-10-25T10:10:24",
        "lot": "",
        "write_off": false,
        "region": [],
        "location": [],
        "bbe_date": null,
        "expiry_threshold": 0,
        "inbound_stock": "0",
        "stock_on_hold": 0,
        "sold_today": 0,
        "sales_last_days": 0,
        "reserved_stock": 0,
        "customer_returns": 0,
        "warehouse_damage": 0,
        "lost_in_post": 0,
        "other_logs": 0,
        "out_stock_days": 108,
        "lost_sales": 0,
        "update_date": "2020-10-05T07:20:53",
        "meta_data": {
            "sku": "",
            "manage_stock": true,
            "stock_quantity": 0,
            "backorders": "no",
            "stock_status": "instock",
            "supplier_id": "",
            "supplier_sku": "",
            "barcode": "",
            "sold_individually": false,
            "out_stock_threshold": 0,
            "low_stock_threshold": "",
            "purchase_price": "128",
            "price": "9",
            "regular_price": "9",
            "sale_price": "",
            "date_on_sale_from": null,
            "date_on_sale_to": null,
            "out_stock_date": "2020-06-18T09:08:57",
            "expired_stock": null,
            "is_expired": false
        },
        "_links": {
            "self": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/83/inventories/7"
                }
            ],
            "collection": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/83/inventories"
                }
            ],
            "up": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/83"
                }
            ]
        }
    },
    {
        "id": "10",
        "product_id": 37,
        "name": "Main Inventory",
        "priority": 0,
        "is_main": true,
        "inventory_date": "2018-06-06T10:14:00",
        "lot": "123456",
        "write_off": false,
        "region": [],
        "location": [],
        "bbe_date": null,
        "expiry_threshold": 0,
        "inbound_stock": "0",
        "stock_on_hold": 0,
        "sold_today": 0,
        "sales_last_days": 0,
        "reserved_stock": 0,
        "customer_returns": 0,
        "warehouse_damage": 1,
        "lost_in_post": 0,
        "other_logs": 0,
        "out_stock_days": 0,
        "lost_sales": 0,
        "update_date": "2020-06-04T06:20:29",
        "meta_data": {
            "sku": "",
            "manage_stock": true,
            "stock_quantity": 2,
            "backorders": "no",
            "stock_status": "instock",
            "supplier_id": "",
            "supplier_sku": "",
            "barcode": "",
            "sold_individually": false,
            "out_stock_threshold": "",
            "low_stock_threshold": "",
            "purchase_price": "5",
            "price": "12",
            "regular_price": "12",
            "sale_price": "",
            "date_on_sale_from": null,
            "date_on_sale_to": null,
            "out_stock_date": null,
            "expired_stock": null,
            "is_expired": false
        },
        "_links": {
            "self": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/37/inventories/10"
                }
            ],
            "collection": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/37/inventories"
                }
            ],
            "up": [
                {
                    "href": "http://example.com/wp-json/wc/v3/products/37"
                }
            ]
        }
    }
]

Available parameters

ParameterTypeDescription
contextstringScope under which the request is made; determines fields present in response. Options: view and edit.
pageintegerCurrent page of the collection. Default is 1.
per_pageintegerMaximum number of items to be returned in result set. Default is 10.
searchstringLimit results to inventories whose name contains the specified string.
afterstringLimit response to resources created after a given ISO8601 compliant date.
beforestringLimit response to resources created before a given ISO8601 compliant date.
modified_afterstringLimit response to inventories whose data was updated after a given ISO8601 compliant date.
modified_beforestringLimit response to inventories whose data was updated before a given ISO8601 compliant date.
dates_are_gmtbooleanWhether the dates passed to the date filters are in GMT. Default is false.
excludearrayEnsure result set excludes specific IDs.
includearrayLimit result set to specific IDs.
offsetintegerOffset the result set by a specific number of items.
orderstringOrder sort attribute ascending or descending. Options: asc and desc. Default is asc.
orderbystringSort collection by object attribute. Options: priority, inventory_date, id, name and bbe_date. Default is id.
namestringLimit result set to inventories with a specific name.
exclude_write_offbooleanExclude from result set the inventories that were marked as 'write off'. Default is true.
lotstringLimit result set to inventories with the specified LOT/BATCH number.
barcodestringLimit result set to inventories with the specified barcode.
countrystringIf the country restriction mode is enabled, limit the result set to inventories linked to the specified country code. countries is accepted as an alias.
shipping_zonestringIf the shipping zone restriction mode is enabled, limit the result set to inventories linked to the specified shipping zone name. shipping_zones is accepted as an alias.
locationstringLimit the result set to inventories linked to the specified location. It accepts a location term ID or a location name.
productintegerLimit result set to inventories of the specified product ID.

Update an inventory

This API lets you make changes to a product inventory.

HTTP request

PUT/wp-json/wc/v3/products/<product_id>/inventories/<id>
curl -X PUT https://example.com/wp-json/wc/v3/products/507/inventories/208 \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
   "meta_data": {
       "stock_quantity": 200
   } 
}'
JSON response example
{
    "id": 208,
    "product_id": 507,
    "name": "Inventory 1",
    "priority": 0,
    "is_main": false,
    "inventory_date": "2020-09-01T09:16:19",
    "lot": "",
    "write_off": false,
    "region": [],
    "location": [],
    "bbe_date": null,
    "expiry_threshold": 0,
    "meta_data": {
        "sku": "TEST1",
        "manage_stock": true,
        "stock_quantity": 200,
        "backorders": "no",
        "stock_status": "instock",
        "supplier_id": "",
        "supplier_sku": "",
        "barcode": "",
        "sold_individually": false,
        "out_stock_threshold": "",
        "low_stock_threshold": "",
        "purchase_price": "9.5",
        "price": "12",
        "regular_price": "12",
        "sale_price": "",
        "date_on_sale_from": null,
        "date_on_sale_to": null,
        "out_stock_date": null,
        "expired_stock": null,
        "is_expired": false
    },
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
            }
        ],
        "up": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507"
            }
        ]
    }
}

Delete a product inventory

This API helps you delete a product inventory. The Main Inventory of a product can't be deleted.

HTTP request

DELETE/wp-json/wc/v3/products/<product_id>/inventories/<id>
curl -X DELETE https://example.com/wp-json/wc/v3/products/507/inventories/208?force=true \
	-u consumer_key:consumer_secret
JSON response example
{
    "id": 208,
    "product_id": 507,
    "name": "Inventory 1",
    "priority": 0,
    "is_main": false,
    "inventory_date": "2020-09-01T09:16:19",
    "lot": "",
    "write_off": false,
    "region": [],
    "location": [],
    "bbe_date": null,
    "expiry_threshold": 0,
    "meta_data": {
        "sku": "TEST1",
        "manage_stock": true,
        "stock_quantity": 200,
        "backorders": "no",
        "stock_status": "instock",
        "supplier_id": "",
        "supplier_sku": "",
        "barcode": "",
        "sold_individually": false,
        "out_stock_threshold": "",
        "low_stock_threshold": "",
        "purchase_price": "9.5",
        "price": "12",
        "regular_price": "12",
        "sale_price": "",
        "date_on_sale_from": null,
        "date_on_sale_to": null,
        "out_stock_date": null,
        "expired_stock": null,
        "is_expired": false
    },
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
            }
        ],
        "up": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/507"
            }
        ]
    }
}

Available parameters

ParameterTypeDescription
forcebooleanRequired to be true, as inventories do not support trashing. Default is false.

Batch update product inventories

This API helps you to batch create, update and delete multiple product inventories.

Note: By default it's limited to up to 100 objects to be created, updated or deleted. The inventories listed in delete are always deleted permanently.

HTTP request

POST/wp-json/wc/v3/products/<product_id>/inventories/batch
curl -X POST https://example.com/wp-json/wc/v3/products/507/inventories/batch \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
    "create": [
        {
            "name": "TEST Batch Inventory",
            "is_main": false
        }
    ],
    "update": [
        {
            "id": 152,
            "meta_data": {
                "manage_stock": true,
                "stock_quantity": 20
            }
        }
    ],
    "delete": [ 210, 211 ]
}'
JSON response example
{
    "create": [
        {
            "id": 212,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 0,
            "is_main": false,
            "inventory_date": "2020-09-01T11:11:31",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": [],
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": false,
                "stock_quantity": null,
                "backorders": "no",
                "stock_status": "",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "",
                "price": "",
                "regular_price": "",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/212"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        }
    ],
    "update": [
        {
            "id": 152,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 1,
            "is_main": false,
            "inventory_date": "2019-06-11T10:08:00",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": {
                "53": "slovakia",
                "49": "valencia"
            },
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": true,
                "stock_quantity": 20,
                "backorders": "no",
                "stock_status": "instock",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "5",
                "price": "20",
                "regular_price": "20",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/152"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        }
    ],
    "delete": [
        {
            "id": 210,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 0,
            "is_main": false,
            "inventory_date": "2020-09-01T11:10:02",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": [],
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": false,
                "stock_quantity": null,
                "backorders": "no",
                "stock_status": "",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "",
                "price": "",
                "regular_price": "",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/210"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        },
        {
            "id": 211,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 0,
            "is_main": false,
            "inventory_date": "2020-09-01T11:10:05",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": [],
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": false,
                "stock_quantity": null,
                "backorders": "no",
                "stock_status": "",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "",
                "price": "",
                "regular_price": "",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/211"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        }
    ]
}

Batch update All inventories

This API helps you to batch create, update and delete multiple inventories at once and also mixing inventories from distinct products at the same time.

Note: By default it's limited to up to 100 objects to be created, updated or deleted. Each inventory in create must include the product_id it belongs to. The inventories listed in delete are always deleted permanently.

HTTP request

POST/wp-json/wc/v3/atum/inventories/batch
curl -X POST https://example.com/wp-json/wc/v3/atum/inventories/batch \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
    "create": [
        {
            "product_id": 2123,
            "name": "TEST Batch Inventory",
            "is_main": false
        }
    ],
    "update": [
        {
            "id": 152,
            "meta_data": {
                "manage_stock": true,
                "stock_quantity": 20
            }
        }
    ],
    "delete": [ 210, 211 ]
}'
JSON response example
{
    "create": [
        {
            "id": 212,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 0,
            "is_main": false,
            "inventory_date": "2020-09-01T11:11:31",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": [],
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": false,
                "stock_quantity": null,
                "backorders": "no",
                "stock_status": "",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "",
                "price": "",
                "regular_price": "",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/212"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        }
    ],
    "update": [
        {
            "id": 152,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 1,
            "is_main": false,
            "inventory_date": "2019-06-11T10:08:00",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": {
                "53": "slovakia",
                "49": "valencia"
            },
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": true,
                "stock_quantity": 20,
                "backorders": "no",
                "stock_status": "instock",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "5",
                "price": "20",
                "regular_price": "20",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/152"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        }
    ],
    "delete": [
        {
            "id": 210,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 0,
            "is_main": false,
            "inventory_date": "2020-09-01T11:10:02",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": [],
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": false,
                "stock_quantity": null,
                "backorders": "no",
                "stock_status": "",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "",
                "price": "",
                "regular_price": "",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/210"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        },
        {
            "id": 211,
            "product_id": 507,
            "name": "TEST Batch Inventory",
            "priority": 0,
            "is_main": false,
            "inventory_date": "2020-09-01T11:10:05",
            "lot": "",
            "write_off": false,
            "region": [],
            "location": [],
            "bbe_date": null,
            "expiry_threshold": 0,
            "meta_data": {
                "sku": "",
                "manage_stock": false,
                "stock_quantity": null,
                "backorders": "no",
                "stock_status": "",
                "supplier_id": "",
                "supplier_sku": "",
                "barcode": "",
                "sold_individually": false,
                "out_stock_threshold": "",
                "low_stock_threshold": "",
                "purchase_price": "",
                "price": "",
                "regular_price": "",
                "sale_price": "",
                "date_on_sale_from": null,
                "date_on_sale_to": null,
                "out_stock_date": null,
                "expired_stock": null,
                "is_expired": false
            },
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories/211"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507/inventories"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/507"
                    }
                ]
            }
        }
    ]
}

On this page