https://api.genuka.com · Auth Authorization: Bearer <token> + X-Company: <companyId> · See Getting Started for shared conventions, pagination & error formats.
Endpoints at a glance
Warehouses
GET /2023-11/admin/warehouses
List all warehouses accessible to the authenticated user. Managers with assigned warehouses see only their subset.
- Query parameters:
Request example:
200 OK:
400— missingX-Companyheader401— invalid or expired token
POST /2023-11/admin/warehouses
Create a new warehouse for the company.
- Request body:
Request example:
200 OK:
400— missingX-Companyheader401— invalid token500— internal error (e.g. image upload failure)
GET /2023-11/admin/warehouses/{warehouse}
Retrieve a single warehouse by ID.
- Path parameters:
Request example:
200 OK:
401— invalid token404— warehouse not found or not accessible
PUT /2023-11/admin/warehouses/{warehouse}
Update an existing warehouse.
- Path parameters:
- Request body: All fields are optional. Only provided fields are updated.
Request example:
200 OK:
401— invalid token404— warehouse not found500— internal error
DELETE /2023-11/admin/warehouses/{warehouse}
Permanently delete a warehouse (force-deletes, bypassing soft-delete).
- Path parameters:
Request example:
204 No Content:
401— invalid token404— warehouse not found
Stocks
A Stock is a company-level inventory record for one product variant, with quantities tracked per warehouse viastocks_warehouse pivot entries.
GET /2023-11/admin/stocks
List stocks with optional filtering, sorting, and relationship loading.
- Query parameters:
Request example:
200 OK:
400— missingX-Companyheader401— invalid token
POST /2023-11/admin/stocks
Create a new stock record, optionally linking it to a product variant and assigning warehouse quantities.
- Request body:
Request example:
200 OK:
400— missingX-Companyheader401— invalid token422—titlealready exists for this company, or validation errors500— internal error (warehouse sync or media upload failure)
GET /2023-11/admin/stocks/analytics
Returns aggregate inventory statistics for the company (or active shop).
Request example:
200 OK:
inventory_value— total cost of all stock on hand, computed asSUM(quantity × COALESCE(supplier_price, stock_price, variant_price, 0))total_stocks— total unit quantity across all warehouses
401— invalid token400— missingX-Companyheader
POST /2023-11/admin/stocks/export
Trigger an asynchronous export of the stocks list. Returns immediately; the export is processed in the background.
- Request body:
Request example:
200 OK:
download_url once status becomes completed.
Error responses:
401— invalid or unauthenticated request
GET /2023-11/admin/stocks/export/fields
List all available column keys that can be requested in a stock export.
Request example:
200 OK:
401— invalid token
POST /2023-11/admin/stocks/add-stock
Receive stock into a warehouse. Each line creates a new stock_warehouse lot entry. The system resolves or auto-creates a stock record from a product_variant_id if no stock_id is given.
- Request body:
Request example:
200 OK:
400— insufficient stock, mismatched warehouse, or general error403— warehouse not found or not accessible422— validation errors (missing required fields, invalid quantity)
POST /2023-11/admin/stocks/move-stock
Manually adjust (add or remove) stock quantities in a warehouse belonging to the active shop. Requires X-Shop header (or shopId in the body).
- Request body:
Request example:
200 OK:
400— shop not provided, insufficient stock, or warehouse mismatch403— company or shop not found / not accessible422— validation errors
GET /2023-11/admin/stocks/{stock}
Retrieve a single stock with related product variant, compositions, and warehouses.
- Path parameters:
Request example:
200 OK:
401— invalid token404— stock not found
PUT /2023-11/admin/stocks/{stock}
Update a stock record. All fields are optional on update.
- Path parameters:
- Request body:
Request example:
200 OK:
401— invalid token404— stock not found500— internal error
DELETE /2023-11/admin/stocks/{stock}
Soft-delete a stock record and cascade-delete all its stock_warehouse entries.
- Path parameters:
Request example:
200 OK:
401— invalid token404— stock not found
Stock History
Stock history records an audit log of every quantity change per warehouse lot. Each entry has atype (e.g. sale, purchase, adjustment, inventory, movement), a signed quantity_delta, and the running balance after the change (balance_after). Unlike the old ledger format, entries are immutable — the PUT endpoint route exists but its controller method is not yet implemented.
GET /2023-11/admin/stockHistory
List stock history entries. Results are automatically filtered to warehouses accessible to the current user.
- Query parameters:
Request example:
200 OK:
quantity_delta— signed change: positive = stock in, negative = stock outbalance_after— running total of the stock in that warehouse after this entry (aliased fromquantitycolumn)total_quantity— present only when the list was built with a cumulative running total query; omitted otherwisesource_type— short alias (order,bill,return,inventory,movement)
400— missingX-Company401— invalid token
POST /2023-11/admin/stockHistory/{stock}
Manually append a stock history entry for a given stock.
- Path parameters:
- Request body:
Request example:
200 OK:
401— invalid token404— stock not found500— internal error
GET /2023-11/admin/stockHistory/{stockHistory}
Retrieve a single stock history entry.
- Path parameters:
Request example:
200 OK:
401— invalid token404— history entry not found
PUT /2023-11/admin/stockHistory/{stockHistory}
Note: The controller update method is not yet implemented. The route exists but currently returns an empty response. Stock history entries are immutable audit records; use this endpoint only if the controller is updated in a future release.
- Path parameters:
- Request body (anticipated):
Success response
200 OK (anticipated once implemented):
DELETE /2023-11/admin/stockHistory/{stockHistory}
Delete a stock history entry.
- Path parameters:
Request example:
200 OK:
401— invalid token404— history entry not found
Stock Movements
A Stock Movement represents an inter-warehouse transfer of stock. Status values:scheduled, in_progress, completed. A completed movement cannot be modified.
GET /2023-11/admin/stockMovement
List stock movements with filtering and sorting.
- Query parameters:
Request example:
200 OK:
400— missingX-Company401— invalid token
POST /2023-11/admin/stockMovement
Create a new stock movement between two warehouses.
- Request body:
Request example:
200 OK:
401— invalid token422— source and destination warehouses are the same; lines missing; validation errors
GET /2023-11/admin/stockMovement/{stockMovement}
Retrieve a single stock movement with all related data.
- Path parameters:
Request example:
200 OK:
401— invalid token404— movement not found
PUT /2023-11/admin/stockMovement/{stockMovement}
Update a stock movement. All fields are optional.
- Path parameters:
- Request body:
Request example:
200 OK:
401— invalid token404— movement not found422— validation errors
DELETE /2023-11/admin/stockMovement/{stockMovement}
Soft-delete a stock movement. Pass force=true to permanently delete.
- Path parameters:
- Query parameters:
Request example:
200 OK:
401— invalid token404— movement not found
PATCH /2023-11/admin/stockMovement/{stockMovement}/status
Transition a stock movement to a new status. When transitioning to completed, source stock quantities are decremented and destination stock quantities are incremented atomically.
A movement that is alreadycompletedcannot be modified and returns400.
- Path parameters:
- Request body:
Request example:
200 OK:
400— movement is already completed401— invalid token404— movement not found422— invalid status value
Stock Inventories
A Stock Inventory is a physical count session for one warehouse. Statuses:draft → in_progress → validated (or cancelled). Only draft and in_progress inventories are editable. Validation generates accounting adjustment entries.
GET /2023-11/admin/inventories
List stock inventories with filtering and sorting.
- Query parameters:
Request example:
200 OK:
400— missingX-Company401— invalid token
POST /2023-11/admin/inventories
Create a stock inventory session. If stock_ids is omitted, all stocks with quantity > 0 in the target warehouse are automatically included as lines (streamed in batches).
- Request body:
Request example:
201 Created:
401— invalid token422— validation errors
GET /2023-11/admin/inventories/{inventory}
Retrieve a single inventory with all its lines, media, and related warehouse.
- Path parameters:
Request example:
200 OK:
401— invalid token404— inventory not found
PUT /2023-11/admin/inventories/{inventory}
Update an inventory’s top-level metadata (reason, notes, date) and manage proof media attachments. Only editable when status is draft or in_progress.
- Path parameters:
- Request body:
Request example:
200 OK:
400— inventory is not in an editable state401— invalid token404— inventory not found
POST /2023-11/admin/inventories/{inventory}/cancel
Cancel a draft or in_progress inventory. Cannot cancel a validated inventory.
- Path parameters:
Request example:
Request body: None — no body required for this action endpoint.
200 OK:
400— inventory cannot be cancelled (e.g. already validated)401— invalid token404— inventory not found
PATCH /2023-11/admin/inventories/{inventory}/lines/{line}
Update the counted quantity for a single inventory line. The first count on any line auto-transitions the inventory from draft to in_progress.
- Path parameters:
- Request body:
Request example:
200 OK:
400— inventory not editable401— invalid token404— inventory or line not found422—counted_quantitymissing or invalid422— line does not belong to this inventory
DELETE /2023-11/admin/inventories/{inventory}/medias/{media}
Remove a proof media attachment from an inventory. Only allowed while the inventory is still editable.
- Path parameters:
Request example:
200 OK:
400— inventory not editable401— invalid token404— inventory or media not found
POST /2023-11/admin/inventories/{inventory}/validate
Validate a fully-counted inventory. Requirements: (1) inventory must be in_progress, (2) all lines must have a counted_quantity, (3) at least one proof media must be attached. On success: stock quantities are adjusted in the warehouse, one accounting transaction is generated for all differences, and the inventory status is set to validated.
- Path parameters:
- Request body: None — this is a pure action endpoint. No body is required.
200 OK:
400— inventory cannot be validated (wrong status, uncounted lines, or missing proof media). Error messages:"N lines have not been counted yet"— not all lines havecounted_quantity"No proof attached"— no media on inventory or lines"Cannot validate inventory with status: draft"— wrong status
401— invalid token404— inventory not found
Transfers
A Transfer is a treasury-account fund movement. Deducts from the source account balance and credits the destination. Automatically creates accounting book entries.GET /2023-11/admin/transfers
List treasury transfers.
- Query parameters:
Request example:
200 OK:
400— missingX-Company401— invalid token
POST /2023-11/admin/transfers
Create a treasury transfer. Immediately deducts from source and credits destination; fails if the source has insufficient balance.
- Request body:
Request example:
200 OK:
400— source balance insufficient ("Insufficient balance")401— invalid token404— source or destination treasury account not found
GET /2023-11/admin/transfers/{transfer}
Retrieve a single transfer.
- Path parameters:
Request example:
Note: The controllerSuccess responseshowmethod body is not yet implemented. The route exists but currently returns an empty response. When implemented, it will return aTransferResourceobject matching the shape shown in thePOSTsuccess response.
200 OK (anticipated once implemented):
PUT /2023-11/admin/transfers/{transfer}
Update a transfer.
- Path parameters:
- Request body (anticipated):
Request example:
Note: The controller update method body is not yet implemented. The route exists but currently returns an empty response.
Success response 200 OK (anticipated once implemented):
DELETE /2023-11/admin/transfers/{transfer}
Delete a transfer. Automatically reverses the source/destination balance changes and reverts all associated book entries.
- Path parameters:
Request example:
Note: The controllerSuccess responsedestroymethod body is not yet implemented. The route exists but balance reversal logic is defined in the model’sdeletingobserver.
200 OK (anticipated once implemented):
