Ledga
PATCH /attribute-definitions/{key}

Update an attribute definition's label, indexed flag or value type

Update a declared key's mutable metadata (label / indexed), or its value_type while the key has no stored values; the key itself is immutable. Requires the attributes:admin capability on the API key; a key without it receives 403 ATTRIBUTE_ADMIN_CAPABILITY_REQUIRED.

Parameters

NameInTypeDescription
keyrequired path string

Request body

FieldTypeDescription
label string
nullable
indexed boolean
value_type string
enum: string | integer | decimal | date
Refused with 422 ATTRIBUTE_TYPE_LOCKED once the key has stored values.

Responses

200Attribute definition updated
{
  "success": true,
  "data": {
    "id": "01997c1e-4d2a-7c3e-9a1b-2f0e8c6d4b5a",
    "key": "customer_id",
    "label": "Customer ID",
    "indexed": true,
    "value_type": "decimal",
    "usage_count": 1200,
    "first_seen_at": null,
    "last_seen_at": null,
    "created_at": "2026-01-15T10:30:00Z",
    "updated_at": "2026-01-15T10:30:00Z"
  }
}
401Unauthenticated
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}
403Forbidden — missing the required 'attributes:admin' capability (ATTRIBUTE_ADMIN_CAPABILITY_REQUIRED)
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}
404Attribute definition not found
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}
422Validation error, or ATTRIBUTE_TYPE_LOCKED: value_type cannot change once the key has stored values
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}

Examples

curl -X PATCH https://ledga.io/api/v1/attribute-definitions/{key} \
  -H "Authorization: Bearer sk_xxxxxxxx_your_secret" \
  -H "Content-Type: application/json" \
  -d '{
  "label": "Customer ID",
  "indexed": false,
  "value_type": "decimal"
}'

← All endpoints