Skip to main content
PUT
/
api
/
v1
/
contracts
/
{id}
/
attribute-values
curl -X PUT "https://commodityai.app/api/v1/contracts/123e4567-e89b-12d3-a456-426614174000/attribute-values" \
  -H "Authorization: Bearer cai_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-contract-10024-attributes" \
  -d '{
    "values": [
      {
        "product_attribute_id": "a23e4567-e89b-12d3-a456-426614174009",
        "value": "Brazil"
      },
      {
        "product_attribute_id": "b23e4567-e89b-12d3-a456-426614174010",
        "option_id": "c23e4567-e89b-12d3-a456-426614174011"
      }
    ]
  }'
[
  {
    "contract_id": "123e4567-e89b-12d3-a456-426614174000",
    "product_attribute_id": "a23e4567-e89b-12d3-a456-426614174009",
    "value": "Brazil"
  }
]

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.

Sets product attribute values for a contract. This is the post-create equivalent of sending structured quality_attributes during contract creation.

Path Parameters

id
string
required
Contract UUID.

Headers

HeaderRequiredNotes
Idempotency-KeyYesUnique key for safely retrying this write. Use a stable value from your source system, such as erp-contract-10024-attributes.

Request Body

values
array
required
Attribute values to set for the contract.
values[].product_attribute_id
string
required
Product attribute UUID.
values[].option_id
string
Selected option UUID for option-backed attributes.
values[].value
string
Scalar attribute value.
values[].values
array
Multi-value attribute values.

Request Example

curl -X PUT "https://commodityai.app/api/v1/contracts/123e4567-e89b-12d3-a456-426614174000/attribute-values" \
  -H "Authorization: Bearer cai_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-contract-10024-attributes" \
  -d '{
    "values": [
      {
        "product_attribute_id": "a23e4567-e89b-12d3-a456-426614174009",
        "value": "Brazil"
      },
      {
        "product_attribute_id": "b23e4567-e89b-12d3-a456-426614174010",
        "option_id": "c23e4567-e89b-12d3-a456-426614174011"
      }
    ]
  }'

Response

[
  {
    "contract_id": "123e4567-e89b-12d3-a456-426614174000",
    "product_attribute_id": "a23e4567-e89b-12d3-a456-426614174009",
    "value": "Brazil"
  }
]

Errors

StatusCodeMeaning
400validation_errorAttribute IDs, option IDs, or values are invalid.
404not_foundThe contract, product attribute, or option was not found for the company.
409conflictThe attribute does not apply to the contract product or current lifecycle state.