Link Purchase Item
POST
/api/v1/purchases/{purchaseId}/link-itemsLink 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
| Field | Type | Required | Description |
|---|---|---|---|
| purchaseId | string | Required | The supplier invoice number (spplrInvcNo) of the purchase to link. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| links | array | Required | Array of item link mappings. |
| links[].spplrItemCd | string | Required | The supplier's item code from the purchase record. |
| links[].localItemCd | string | Required | Your local Ushuru item code to link to. |
| links[].itemNm | string | Optional | Item 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"
}]
}'