Tracepos Developer HubTracepos Developer Hub
Home
Guide
POS & Integrations
API Reference
Webhooks
Home
Guide
POS & Integrations
API Reference
Webhooks
  • Core Catalog & Outlets

    • Products API
    • Categories & Brands API
    • Warehouses & Outlets API
  • Parties & CRM

    • Customers & Suppliers API
  • Operations & Stock

    • Sales & Transactions API
    • Purchases & Procurement API
    • Inventory & Price Adjustments API
    • Returns & Reversals API
  • Financial Ledger & Expenses

    • Payments & Settlements API
    • Expense Management API
    • Double-Entry Accounting Architecture
  • Real-Time Sync

    • Webhooks & Real-Time Sync

Inventory & Price Adjustments API

Accurate retail and warehouse management requires handling non-sale physical inventory variations (breakage, spoilage, shrinkage, audit counts) and programmatic price updates (repricing campaigns, inflation adjustments, competitor matching).

The Adjustments API covers both Stock Adjustments (physical quantity alterations with automated ledger reconciliation) and Price Adjustments (retail price modifications with historical audit logs).


1. Stock Adjustments

Stock adjustments change on-hand inventory levels outside the standard sales/procurement pipeline.

List Stock Adjustments

Retrieve historical stock adjustments performed at the authorized warehouse.

GET/api/v1/public/stock-adjustments

Response (200 OK)

{
  "status": "success",
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": 14,
        "product_id": 45,
        "quantity": "5.00",
        "adjustment_type": "subtract",
        "notes": "Damaged goods in transit",
        "created_at": "2026-09-29T11:20:00.000000Z",
        "product": {
          "id": 45,
          "name": "Premium Basmati Rice 5kg",
          "item_code": "RICE-5KG-01"
        },
        "creator": {
          "id": 1,
          "name": "Warehouse Manager"
        }
      }
    ],
    "total": 14
  }
}

Record Stock Adjustment

Submit a physical stock count adjustment. Tracepos immediately recalculates warehouse stock levels and posts an automated journal entry between Inventory Asset (11700) and COGS / Inventory Loss (51100).

POST/api/v1/public/stock-adjustments

Request Parameters

ParameterTypeRequiredDescription
product_idInteger / StringYesProduct ID to adjust
quantityNumericYesQuantity to add or subtract (min: 0.01)
adjustment_typeStringYes'add' (increase on-hand) or 'subtract' (decrease on-hand)
notesStringNoAudit reason (e.g. Physical audit recount, Water damage)
batch_numberStringNoProduct batch number if adjusting tracked batch stock
expiry_dateDateNoBatch expiry date (YYYY-MM-DD)

Code Examples

:::: code-group ::: code-group-item cURL

curl -X POST "https://api.tracepos.com/api/v1/public/stock-adjustments" \
  -H "X-Tracepos-Public-Key: tp_pub_live_7f8a9c2d1e" \
  -H "X-Tracepos-Secret-Key: tp_sec_live_9b3e1f7a4c" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "product_id": 45,
    "quantity": 3,
    "adjustment_type": "subtract",
    "notes": "Expired carton removed during audit"
  }'

::: ::: code-group-item Node.js (Axios)

const axios = require('axios');

async function adjustStock(productId, quantity, type, notes) {
  const response = await axios.post(
    'https://api.tracepos.com/api/v1/public/stock-adjustments',
    {
      product_id: productId,
      quantity: quantity,
      adjustment_type: type,
      notes: notes
    },
    {
      headers: {
        'X-Tracepos-Public-Key': process.env.TRACEPOS_PUBLIC_KEY,
        'X-Tracepos-Secret-Key': process.env.TRACEPOS_SECRET_KEY,
        'Content-Type': 'application/json',
        'Accept': 'application/json'
      }
    }
  );

  return response.data;
}

::: ::: code-group-item Python (Requests)

import os
import requests

headers = {
    "X-Tracepos-Public-Key": os.getenv("TRACEPOS_PUBLIC_KEY"),
    "X-Tracepos-Secret-Key": os.getenv("TRACEPOS_SECRET_KEY"),
    "Content-Type": "application/json",
    "Accept": "application/json"
}

payload = {
    "product_id": 45,
    "quantity": 3,
    "adjustment_type": "subtract",
    "notes": "Expired carton removed during audit"
}

response = requests.post(
    "https://api.tracepos.com/api/v1/public/stock-adjustments",
    json=payload,
    headers=headers
)
result = response.json()

::: ::: code-group-item PHP (Guzzle)

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.tracepos.com/api/v1/public/']);

$response = $client->post('stock-adjustments', [
    'headers' => [
        'X-Tracepos-Public-Key' => getenv('TRACEPOS_PUBLIC_KEY'),
        'X-Tracepos-Secret-Key' => getenv('TRACEPOS_SECRET_KEY'),
        'Content-Type'          => 'application/json',
        'Accept'                => 'application/json'
    ],
    'json' => [
        'product_id'      => 45,
        'quantity'        => 3,
        'adjustment_type' => 'subtract',
        'notes'           => 'Expired carton removed during audit'
    ]
]);

$result = json_decode($response->getBody()->getContents(), true);

::: ::::

Response (200 OK)

{
  "status": "success",
  "adjustment_id": 15,
  "new_stock_level": 42.00
}

2. Price Adjustments

The Price Adjustment API lets POS management systems and eCommerce pricing engines update unit selling prices while maintaining an immutable audit history of price revisions.

List Price Adjustment Batches

GET/api/v1/public/price-adjustments

Response (200 OK)

{
  "status": "success",
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": 8,
        "invoice_number": "ADJ-BATCH-8",
        "date": "2026-09-25",
        "notes": "Quarterly inflation repricing",
        "creator": {
          "id": 1,
          "name": "Finance Admin"
        }
      }
    ],
    "total": 8
  }
}

Update Product Price

Update a product's retail selling price for the authorized warehouse.

POST/api/v1/public/price-adjustments

Request Parameters

ParameterTypeRequiredDescription
product_idInteger / StringYesProduct ID to reprice
new_sales_priceNumericYesNew selling price (min: 0.00)

Request Payload

{
  "product_id": 45,
  "new_sales_price": 2950.00
}

Response (200 OK)

{
  "status": "success",
  "batch_invoice": "ADJ-BATCH-9",
  "new_price": 2950.00
}

Accounting & Inventory Integrity

Double-Entry Valuation

Whenever stock is added or subtracted via POST /stock-adjustments, the cost value of the movement ($\text{Cost} = \text{purchase_price} \times \text{quantity}$) is posted to the general ledger:

  • Add Stock (add):
    • Debit: 11700 Inventory Asset
    • Credit: 51100 Inventory Adjustment Gain
  • Subtract Stock (subtract):
    • Debit: 51100 Inventory Shrinkage & Loss (COGS)
    • Credit: 11700 Inventory Asset
Prev
Purchases & Procurement API
Next
Returns & Reversals API