Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CodexaCP/DG_BACK/llms.txt

Use this file to discover all available pages before exploring further.

Dragon Guard’s inventory engine is built on an append-only ledger stored in InventoryMovements. Every inbound receipt, outbound shipment, opening balance, adjustment, or transfer writes one or more movement rows. The current on-hand quantity for any item in any bin is the running sum of all movement quantities for that (CompanyId, ItemId, BinId) combination. Positive quantities represent stock increases (inbound); negative quantities represent stock decreases (outbound). All movement endpoints are company-scoped. CompanyId is resolved from the bearer token or the optional ?companyId= override.

Inventory Movements Ledger

List movements

GET /api/movements
Query parameters
companyId
uuid
Override company. Resolved from JWT when omitted.
Free-text match on itemNo, itemDescription, binCode, referenceNo, and movementType.
itemId
uuid
Filter by item UUID.
itemNo
string
Partial match on item number.
binId
uuid
Filter by bin UUID.
binCode
string
Partial match on bin code.
locationCode
string
Exact match on location code.
movementType
string
Exact match on movement type (e.g. IN, OUT, ADJUSTMENT).
referenceNo
string
Partial match on reference number.
dateFrom
datetime
Filter movements created on or after this UTC datetime.
dateTo
datetime
Filter movements created on or before this UTC datetime.
sortDesc
boolean
default:"true"
Sort by createdAt descending.
pageNumber
integer
default:"1"
Page number.
pageSize
integer
default:"20"
Records per page (max 200).
Response (paged)
data[].id
uuid
Movement UUID.
data[].itemId
uuid
Item UUID.
data[].itemNo
string
Item number.
data[].itemDescription
string
Item description.
data[].binId
uuid
Bin UUID.
data[].binCode
string
Bin code.
data[].locationCode
string
Location code of the bin.
data[].quantity
decimal
Movement quantity (positive = in, negative = out).
data[].movementType
string
Type code such as IN, OUT, TRANSFER, ADJUSTMENT, OPENING_BALANCE, WEB_CREATION.
data[].referenceNo
string
Source document number (e.g. PR-000001, PS-000001).
data[].createdAt
datetime
Movement timestamp (UTC).
GrupoMASNative tenants: GET /api/movements is a transparent proxy to MAS GET /api/wms/movements, passing companyCode, filters, and pagination. The response shape is identical to the local ledger so handheld and web clients work without modification.

Get a movement by ID

GET /api/movements/{id}
Returns a single InventoryMovementDetailDto for the active company.

Get all movements for an item

GET /api/movements/item/{itemId}
Returns every movement for the specified item in the active company. This is a convenience endpoint; use the main list endpoint with itemId filter for pagination.

Product Journals (GrupoMASNative only)

Product journals are MAS-native inventory adjustment documents. These endpoints are only active for GrupoMASNative tenants. Standalone tenants receive an empty page (totalRecords: 0) from the list endpoint and 404 from the detail/update endpoints.

List product journals

GET /api/movements/journals
companyId
uuid
Override company. Resolved from JWT when omitted.
search
string
Free-text search passed through to MAS.
pageNumber
integer
default:"1"
Page number.
pageSize
integer
default:"50"
Records per page (max 200).
Proxies to MAS GET /api/wms/product-journals. MAS controls the DiarioRegistrado = False filter — only open, unposted journals are returned.

Get a product journal

GET /api/movements/journals/{journalNo}
Returns full journal detail including editable header fields and all lines.

Save a product journal

PUT /api/movements/journals/{journalNo}
Request body (GrupoMasProductJournalSaveRequestDto) The editable fields include:
lines[].locationCode
string
Location code for the line.
lines[].binCode
string
Bin code for the line.
lines[].itemNo
string
Item number.
lines[].quantity
decimal
Quantity to adjust.
lines[].uom
string
Unit of measure.
lines[].lotNo
string
Lot number (if lot-tracked).
lines[].variantCode
string
Variant code.
Cost, amount, currency amount, and other monetary fields are intentionally excluded from the mobile payload. MAS retains sole authority over cost calculations. Submitting these fields has no effect.

Import & Export

Dragon Guard supports Excel-based bulk operations for inventory movements using the INVENTORY_MOVEMENTS configuration package format.

Export movements as Excel

GET /api/movements/export-config
Downloads inventory_movements_config_package.xlsx with the most recent 5,000 movement rows for the active company. The workbook includes the following tenant reference sheets to support data entry:
SheetContents
Ref_ItemsActive item numbers, descriptions, UOM, AllowNegativeAvailable flag
Ref_LocationsActive tenant locations with IsDefault and AllowReceiving flags
Ref_BinsActive bins with location code, type, default/picking/putaway flags
Ref_MovementTypesSupported movement type values (data-validation list)
Excel data-validation lists are attached to the ItemNo, BinCode, WarehouseCode, and MovementType columns so operators can select valid values from dropdowns.

Preview an import

POST /api/movements/preview-config
Content-Type: multipart/form-data
file
file
required
Excel file (.xlsx) generated from the export or matching the package schema.
Returns a per-row preview (CREATE only — reimported rows are always new movements), validation errors, and a confirmationToken.

Apply an import

POST /api/movements/apply-config
Content-Type: multipart/form-data
file
file
required
Excel file.
confirmationToken
string
required
Token from preview response.
Package columns: ItemNo, BinCode, WarehouseCode, Quantity, MovementType, ReferenceNo, EntityType, EntityId, OldStatus, NewStatus, SourceSystem, CreatedBy. Validation rules enforced:
  • ItemNo must exist and be active for the tenant.
  • Quantity must be numeric and non-zero.
  • MovementType must be one of the supported catalog values (see below).
  • BinCode is resolved within WarehouseCode/LocationCode context. If WarehouseCode is blank and the bin code is ambiguous across locations, the row is rejected.
  • For items with allowNegativeAvailable = false, the import simulates cumulative stock row-by-row and rejects any row that would result in negative available inventory.

Standard Movement Type Codes

Dragon Guard maintains a StandardMovementTypesCatalog that enumerates the supported movement types for configuration package import. The catalog includes type codes along with human-readable descriptions in Spanish, English, and Brazilian Portuguese. The following types are commonly used:
CodeDirectionTypical source
INPositiveReceiving post
OUTNegativeShipment post
TRANSFERPositive or negativeInter-location transfer
ADJUSTMENTPositive or negativeInventory adjustment
OPENING_BALANCEPositiveTenant onboarding / integration opening stock
WEB_CREATIONPositiveItem created with initial quantity via web
HANDHELD_CREATIONPositiveItem created with initial quantity via handheld
When importing via Excel, submitting an unsupported custom movement type returns a standardized error that lists all valid codes and their descriptions in three languages, so operators understand what substitution to make.

Inventory Recounts

Inventory recounts (cycle counts) are standalone documents that record system quantities at a point in time alongside operator-counted quantities for variance analysis.

List recounts

GET /api/recounts
search
string
Match on recountNo, status, or assigned operator.
pageNumber
integer
default:"1"
Page number.
pageSize
integer
default:"20"
Records per page.
Response PagedResponse<RecountHeaderDto>
data[].id
uuid
Recount UUID.
data[].recountNo
string
Auto-generated number (RC-NNNNNNN).
data[].recountDate
date
Count date.
data[].assignedToUserId
string
Operator assigned to perform the count.
data[].status
string
OPEN, RELEASED, or APPROVED.
data[].observations
string
Supervisor notes.
data[].createdAt
datetime
Creation timestamp.
data[].createdBy
string
User who created the recount.

Get recount detail

GET /api/recounts/{id}
Returns the full RecountDetailDto including all lines with itemNo, locationCode, binCode, systemQty, and countedQty.

Create a recount

POST /api/recounts
Request body (CreateRecountDto)
recountDate
date
required
Date of count.
assignedToUserId
string
Operator user ID.
lines
array
Count lines with itemNo, locationCode, binCode, systemQty, countedQty.
The recount number is auto-generated from the INVENTORY_RECOUNT document sequence in format RC-NNNNNNN.

Update a recount

PUT /api/recounts/{id}
Permitted only while the document is in OPEN status. Replaces all lines and updates recountDate, assignedToUserId, and observations.
recountDate
date
required
Updated count date.
assignedToUserId
string
Updated operator user ID.
observations
string
Supervisor notes.
lines
array
Replacement set of count lines.

Recount lifecycle actions

Release to operator

POST /api/recounts/{id}/release
Moves status from OPEN to RELEASED. Requires assignedToUserId to be set.

Reopen

POST /api/recounts/{id}/reopen
Moves status back to OPEN. Blocked for APPROVED documents. Optional body: { "observations": "..." }.

Build docs developers (and LLMs) love