Skip to main content

Documentation Index

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

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

The Items and Stock API covers the full lifecycle of product catalog and inventory data accessible from the Dragon Guard WMS web frontend. The frontend operates in a read-oriented mode for day-to-day inventory visibility: stock levels are queried through the enriched stock endpoint, and item movements are available for audit and analysis. Administrative users can additionally create new items and upload product images. No stock manipulation or inventory posting is permitted from the web client — all physical inventory changes originate from handheld warehouse devices.

Endpoints overview

MethodPathDescription
GET/api/stock/enrichedQuery enriched stock with item and location details
POST/api/items/create_itemCreate a new item in the product catalog
POST/api/item-images/uploadUpload a product image and associate it with an item
GET/api/movementsList inventory movement records (read-only)

Enriched stock query

GET /api/stock/enriched
Authorization: Bearer {token}
Returns stock records enriched with item metadata, location, and bin information. This is the primary endpoint for the inventory dashboard and item lookup screens.

Query parameters

companyId
number
required
The ID of the active company. Filters stock to the company’s locations only.
itemId
number
Filter results to a single item by its catalog ID.
locationId
number
Filter results to a specific warehouse location.
binId
number
Filter results to a specific bin within a location.
Free-text search across item code, description, and barcode fields.
page
number
Page number for paginated results (1-based). Defaults to 1.
pageSize
number
Number of records per page. Defaults to 50.
Example response
{
  "data": [
    {
      "itemId": 88,
      "itemCode": "PRD-00088",
      "description": "Caja de cartón corrugado 40x30",
      "barcode": "7890123456789",
      "locationId": 3,
      "locationName": "Almacén Central",
      "binId": 14,
      "binCode": "A-01-03",
      "quantityOnHand": 340,
      "unitOfMeasure": "BOX",
      "imageUrl": "https://cdn.grupoMAS.com/items/88.jpg"
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 50
}

Create an item

POST /api/items/create_item
Authorization: Bearer {token}
Content-Type: application/json
Creates a new product in the company’s item catalog. This operation is restricted to users with catalog administration privileges.

Request body

companyId
number
required
The ID of the company that owns this item.
itemCode
string
required
Unique alphanumeric item code within the company catalog.
description
string
required
Human-readable product description.
barcode
string
Optional EAN/UPC barcode for scanning by handheld devices.
unitOfMeasure
string
required
Base unit of measure code (e.g., EA, BOX, PALLET, KG).
isActive
boolean
Whether the item is active and available for use in documents. Defaults to true.
categoryId
number
Optional category ID for grouping items in the catalog.
Example request
{
  "companyId": 7,
  "itemCode": "PRD-00099",
  "description": "Paleta de madera estándar 1.2m",
  "barcode": "7891234500099",
  "unitOfMeasure": "EA",
  "isActive": true
}
Example response — 201 Created
{
  "id": 99,
  "itemCode": "PRD-00099",
  "description": "Paleta de madera estándar 1.2m",
  "companyId": 7,
  "isActive": true,
  "createdAt": "2024-07-12T11:00:00Z"
}

Upload item image

POST /api/item-images/upload
Authorization: Bearer {token}
Content-Type: multipart/form-data
Uploads a product image and associates it with an existing item. Accepted formats are JPEG and PNG. Images are stored externally and referenced by URL in subsequent stock queries.

Form fields

itemId
number
required
The ID of the item to associate the image with.
file
file
required
The image file. Accepted MIME types: image/jpeg, image/png. Maximum size: 5 MB.
Example request (multipart)
curl -X POST https://api.grupoMAS.com/api/item-images/upload \
  -H "Authorization: Bearer {token}" \
  -F "itemId=99" \
  -F "[email protected]"
Example response — 200 OK
{
  "itemId": 99,
  "imageUrl": "https://cdn.grupoMAS.com/items/99.jpg",
  "uploadedAt": "2024-07-12T11:05:00Z"
}

List inventory movements

GET /api/movements
Authorization: Bearer {token}
Returns a paginated, read-only log of all inventory movements for the specified company. This endpoint is used for the movements audit screen and reporting module.
This endpoint is read-only. It is not possible to create, edit, or reverse inventory movements from the Dragon Guard WMS web frontend. Import and export of movement data are administrative operations only. No inventory posting is available from the web.

Query parameters

companyId
number
required
The ID of the active company. Scopes movement records to the company’s warehouse.
itemId
number
Filter movements for a specific item.
movementType
string
Filter by movement type. Common values: Receipt, Shipment, Adjustment, Transfer.
dateFrom
string
ISO 8601 start date for the movement date range (YYYY-MM-DD).
dateTo
string
ISO 8601 end date for the movement date range (YYYY-MM-DD).
search
string
Free-text search against movement reference fields (document number, item code, etc.).
page
number
Page number (1-based). Defaults to 1.
pageSize
number
Records per page. Defaults to 50.
Example response
{
  "data": [
    {
      "id": 2001,
      "movementType": "Receipt",
      "documentNo": "RCV-2024-0041",
      "itemId": 88,
      "itemCode": "PRD-00088",
      "quantity": 100,
      "locationId": 3,
      "binId": 14,
      "movementDate": "2024-07-15T09:45:00Z",
      "companyId": 7
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 50
}

Business rules

No stock manipulation from the frontend. The web application must not expose any form, button, or API call that directly creates, modifies, or reverses inventory quantities. Stock levels are maintained exclusively by handheld device transactions (receiving, picking, adjustments) flowing through the backend.
  • Item codes must be unique within a company catalog. Attempting to create a duplicate item code returns a 400 validation error.
  • Items referenced by active receipt lines, shipment lines, or movements must not be deleted. Use isActive: false to retire catalog items.
  • The GET /api/stock/enriched response may include items with zero quantityOnHand; these represent catalog entries at locations where no stock is currently present.

Error codes

HTTP StatusMeaning
400Validation error — missing required fields, duplicate item code, unsupported image type
401Missing or expired JWT token
500Internal server error

Build docs developers (and LLMs) love