A warehouse is a place stock is kept, with a unique code and an address. A stock row holds one product’s quantities in one warehouse: available, reserved, in transit and on hand; it is read-only here. A transaction is a ledger entry for one movement of stock, and cannot be changed or deleted once written. A transaction that makes a product available again fires the back-in-stock event that a job can turn into an email.
API ReferenceCommerce
Inventory
Warehouses, stock levels and the inventory transactions that record each movement.
About inventory
Stock rows are listed, not written; they follow the inventory transactions.
Orders, invoices and fulfilmentA transaction cannot be edited or deleted once written.
Orders, invoices and fulfilmentactive is a datetime, like published elsewhere; a new warehouse is inactive.
Members are refused: a 404 by default, a 403 where the site’s access-denied setting says so. Call it from a server with an admin user’s OAuth token or API key.
Authentication and authorisationList warehouses#
/cdna-api/inventory/warehouses
Lists warehouses. Without limit every match comes back.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Warehouse, in the Reference
Parameters
propertiesquery- selector
- The fields and relations to return, such as
{id,name,code,active,address{addressLine1,suburb,postcode,countryName}}. filtersquery- name=value
- Any stored field, or a relation with a dot, such as
parent.id=12. Prefix the name with!,>,<,%or|. Use stored field names exactly as in the model, and comparetotalCountwith the unfiltered list's to confirm a filter applied. orderByquery- string
field:ASCorfield:DESC, comma-separated. Stored fields only.limitquery- integer
- Records per response. There is no default.
offsetquery- integer
- Records to skip.
Example
GET /cdna-api/inventory/warehouses?limit=2&properties={id,name,code,active,address{addressLine1,suburb,postcode,countryName}} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"totalCount": 1,
"data": [
{
"id": 1,
"name": "API sandbox warehouse",
"code": "API-SANDBOX",
"active": null,
"address": {
"addressLine1": "1 Example Street",
"suburb": "Melbourne",
"postcode": "3000",
"countryName": "Australia"
}
}
]
}Show a warehouse#
/cdna-api/inventory/warehouse/{id}
Reads one warehouse by its id.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Warehouse, in the Reference
Parameters
idpathrequired- integer
- The warehouse id.
propertiesquery- selector
- The fields and relations to return, such as
{id,name,code,active,address{addressLine1,suburb,postcode,countryName}}.
Example
GET /cdna-api/inventory/warehouse/1?properties={id,name,code,active,address{addressLine1,suburb,postcode,countryName}} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"data": {
"id": 1,
"name": "API sandbox warehouse",
"code": "API-SANDBOX",
"active": null,
"address": {
"addressLine1": "1 Example Street",
"suburb": "Melbourne",
"postcode": "3000",
"countryName": "Australia"
}
}
}Create a warehouse#
/cdna-api/inventory/warehouse
Creates a warehouse.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Returns
- The new warehouse, in the fields
propertiesasks for, and amessage.
Parameters
namebodyrequired- string
- The name, up to 190 characters.
codebodyrequired- string
- A unique code.
addressbodyrequired- object
companyName,addressLine1,suburb,stateName,postcode,countryName.externalIdbody- string
- The warehouse’s id in another system; unique.
activebody- datetime
truemakes it active now; a new warehouse is inactive.
Example
POST /cdna-api/inventory/warehouse?properties={id,name,code,active,address{addressLine1,suburb,postcode,countryName}} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"name": "API sandbox warehouse",
"code": "API-SANDBOX",
"address": {
"companyName": "Example Pty Ltd",
"addressLine1": "1 Example Street",
"suburb": "Melbourne",
"stateName": "VIC",
"postcode": "3000",
"countryName": "Australia"
}
}{
"result": "success",
"data": {
"id": 1,
"name": "API sandbox warehouse",
"code": "API-SANDBOX",
"active": null,
"address": {
"addressLine1": "1 Example Street",
"suburb": "Melbourne",
"postcode": "3000",
"countryName": "Australia"
}
},
"message": "The Warehouse has been added successfully."
}Edit a warehouse#
/cdna-api/inventory/warehouse/{id}
Changes a warehouse. Fields left out keep their values.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Returns
- The saved warehouse under
data.warehouse, and amessage.
Parameters
idpathrequired- integer
- The warehouse id.
name, code, address, externalId, activebody- As for Create a warehouse.
Example
PUT /cdna-api/inventory/warehouse/9 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"active": true
}Delete a warehouse#
/cdna-api/inventory/warehouse/{id}
Deletes a warehouse and its stock rows.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The warehouse id.
Example
DELETE /cdna-api/inventory/warehouse/9 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/jsonList stock#
/cdna-api/inventory/stocks
Lists stock rows: one product’s quantities in one warehouse. Read-only. This site has none.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Stock, in the Reference
Parameters
propertiesquery- selector
- The fields and relations to return, such as
{id,availableQuantity,reservedQuantity,inTransitQuantity,onHandQuantity}. filtersquery- name=value
- Any stored field, or a relation with a dot, such as
parent.id=12. Prefix the name with!,>,<,%or|. Use stored field names exactly as in the model, and comparetotalCountwith the unfiltered list's to confirm a filter applied. orderByquery- string
field:ASCorfield:DESC, comma-separated. Stored fields only.limitquery- integer
- Records per response. There is no default.
offsetquery- integer
- Records to skip.
Example
GET /cdna-api/inventory/stocks?limit=2&properties={id,availableQuantity,reservedQuantity,inTransitQuantity,onHandQuantity} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"totalCount": 0,
"data": []
}List transactions#
/cdna-api/inventory/transactions
Lists inventory transactions, the ledger of stock movements. This site has none.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Transaction, in the Reference
Parameters
propertiesquery- selector
- The fields and relations to return, such as
{id,productCode,reason,availableQuantity,created}. filtersquery- name=value
- Any stored field, or a relation with a dot, such as
parent.id=12. Prefix the name with!,>,<,%or|. Use stored field names exactly as in the model, and comparetotalCountwith the unfiltered list's to confirm a filter applied. orderByquery- string
field:ASCorfield:DESC, comma-separated. Stored fields only.limitquery- integer
- Records per response. There is no default.
offsetquery- integer
- Records to skip.
Example
GET /cdna-api/inventory/transactions?limit=2&properties={id,productCode,reason,availableQuantity,created} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json{
"result": "success",
"totalCount": 0,
"data": []
}Record a transaction#
/cdna-api/inventory/transaction
Writes a ledger entry for one stock movement. It cannot be changed or deleted afterwards. When it makes a product available again, the back-in-stock event fires.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Returns
- The new transaction under
data.transaction, and amessage. - Model
- Transaction, in the Reference
Parameters
productCodebodyrequired- string
- The product’s or variant’s SKU.
availableQuantity, reservedQuantity, inTransitQuantity, onHandQuantitybody- integer
- The quantities moved; 0 when left out.
warehousebody- integer
- The warehouse, by id.
reasonbody- string
- Why the stock moved.
Example
POST /cdna-api/inventory/transaction HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"productCode": "API-SANDBOX-MUG",
"warehouse": 1,
"reason": "Stocktake",
"availableQuantity": 20,
"onHandQuantity": 20
}{
"result": "error",
"validationErrors": {
"productCode": [
{
"message": "This value should not be blank.",
"code": "c1051bb4-d103-4f74-8988-acbcafc7fdc3",
"propertyPath": "productCode"
}
]
},
"message": "A validation error occurred; please check the submitted fields for errors."
}List an order’s fulfilments#
/cdna-api/inventory/fulfillments/{order.id}
Lists the fulfilments of one order; without the order id, /inventory/fulfillments, every fulfilment.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
order.idpath- integer
- The order id; left out, all fulfilments.
Example
GET /cdna-api/inventory/fulfillments/9 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json