Skip to main content
PATCH
/
api
/
v1
/
allocations
/
{id}
curl -X PATCH "https://commodityai.app/api/v1/allocations/923e4567-e89b-12d3-a456-426614174008" \
  -H "Authorization: Bearer cai_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-allocation-7781-update-quantity" \
  -d '{
    "quantity": "20000"
  }'
{
  "allocation": {
    "id": "923e4567-e89b-12d3-a456-426614174008",
    "quantity": "20000"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.commodityai.io/llms.txt

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

Updates the quantity on an allocation.

Path Parameters

id
string
required
Allocation UUID.

Headers

HeaderRequiredNotes
Idempotency-KeyYesUnique key for safely retrying this write. Use a stable value from your source system, such as erp-allocation-7781-update-quantity.

Request Body

quantity
string
required
Allocated quantity as a positive numeric string.

Request Example

curl -X PATCH "https://commodityai.app/api/v1/allocations/923e4567-e89b-12d3-a456-426614174008" \
  -H "Authorization: Bearer cai_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-allocation-7781-update-quantity" \
  -d '{
    "quantity": "20000"
  }'

Response

{
  "allocation": {
    "id": "923e4567-e89b-12d3-a456-426614174008",
    "quantity": "20000"
  }
}

Errors

StatusCodeMeaning
400validation_errorQuantity is missing or invalid.
404not_foundThe allocation was not found for the company.
409CAPACITY_EXCEEDEDThe new quantity exceeds remaining capacity on a linked leg.
422business_rule_failedThe update is structurally valid but fails an allocation rule.