Returns the reason codes that match the given filters.

POST /inventory/reason-codes/search

Group: Inventory › Reason Codes · Operation ID: searchReasonCodes

Every criterion is exact and criteria combine with AND. Send an empty filters object to return every reason code. There is no free-text search. This endpoint returns documentTypes and is the only one that can filter by a document type, which the collection cannot. The other filters share the names they have on GET inventory/reason-codes.

Open in the interactive reference

Parameters

Name In Type Required Description
Api-Version header "v1" yes The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1.

Request body

Required, application/json: searchReasonCodesInput.

Field Type Required Description
filters object yes The filters to apply. A reason code must match every filter you send. Send an empty object to return all reason codes.
filters.code string no Limits results to the reason code with this code. The match is exact. Codes are unique, so this matches at most one reason code.
filters.isActive boolean no Limits results to reason codes that can be selected on new documents when true, or to retired ones when false. Omit to match both.
filters.requiresApproval boolean no Limits results to reason codes that require approval when true, or that do not when false. Omit to match both.
filters.documentType string, one of "InventoryIncrease", "InventoryDecrease", "SalesReturn", "PurchaseReturn", "Disposal" no Limits results to the reason codes linked to this document type. This filter is available only here, not on the collection. A document type nothing is linked to returns an empty page, not an error.
filters.modifiedSince string (date-time) no Limits results to reason codes changed on or after this time. Format YYYY-MM-DDTHH:mm:ss.sssZ. Adding or removing a document type does not change lastModifiedDate.
page object no The pagination controls. Omit for the first page.
page.cursor string no The cursor from the previous response's pagination.nextCursor. Omit for the first page.
page.size number no The number of reason codes per page. Defaults to 50. A value above 200 is treated as 200, not rejected.

Example:

{
  "filters": {
    "documentType": "InventoryDecrease",
    "isActive": true
  },
  "page": {
    "size": 50
  }
}

Response

200 Success

Under data (searchReasonCodesOutput):

Field Type Required Description
items array of object yes The reason codes on this page, ordered by id. An empty array when nothing matches.
items[].id string yes The unique identifier for the reason code.
items[].code string yes The business code of the reason code, for example 'DAMAGE'. It is unique within the tenant.
items[].description string no A free-form description of what the reason code means. Absent when none was given.
items[].isActive boolean no Whether the reason code can be selected on new documents. When false, existing documents keep it and new ones cannot select it.
items[].requiresApproval boolean no Whether documents using this reason code require approval before they take effect.
items[].documentTypes array of string, one of "InventoryIncrease", "InventoryDecrease", "SalesReturn", "PurchaseReturn", "Disposal" yes The document types this reason code may be selected on, in a stable order. An empty array when it is linked to none. This is the reason code's full set. Filtering by documentType narrows which reason codes are returned, not the set each one reports.
items[].lastModifiedDate string (date-time) no The date and time the reason code record last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. Adding or removing a document type does not change it.
pagination object yes The pagination cursor for this page.
pagination.nextCursor string no The cursor for the next page. Pass it as page.cursor. Absent on the last page.
pagination.hasMore boolean yes True when more reason codes remain beyond this page.

Statuses