Link Purchase Item

POST/api/v1/purchases/{purchaseId}/link-items

Link purchase line items to items in your local Ushuru item registry. Useful for reconciling Kenya Revenue Authority purchase records with your own item codes, enabling accurate stock tracking and reporting.

Requires x-api-key

http://localhost:8100/api/v1/purchases/{purchaseId}/link-items

Path Parameters

FieldTypeRequiredDescription
purchaseIdstringRequiredThe supplier invoice number (spplrInvcNo) of the purchase to link.

Request Body

FieldTypeRequiredDescription
linksarrayRequiredArray of item link mappings.
links[].spplrItemCdstringRequiredThe supplier's item code from the purchase record.
links[].localItemCdstringRequiredYour local Ushuru item code to link to.
links[].itemNmstringOptionalItem name for reference.

Request

{
  "links": [
    {
      "spplrItemCd": "SUPPLIER-SKU-001",
      "localItemCd": "GD0000000Z001",
      "itemNm": "Raw Material A"
    }
  ]
}

Response

{
  "success": true,
  "data": {
    "linked": 1,
    "purchaseId": "SPPLR-INV-001",
    "note": "Link persisted locally. Use a database to store these mappings for future reconciliation."
  }
}
curl -X POST http://localhost:8100/api/v1/purchases/SPPLR-INV-001/link-items \\
  -H "x-api-key: YOUR_API_KEY" \\
  -H "Content-Type: application/json" \\
  -d '{
    "links": [{
      "spplrItemCd": "SUPPLIER-SKU-001",
      "localItemCd": "GD0000000Z001",
      "itemNm": "Raw Material A"
    }]
  }'