Skip to content

Search the documentation by title, section, or page text.

Update Custom Attributes

PUT https://api.botsi.com/v2/custom-attributes

Update existing attribute values, as when a user upgrades from premium to vip, for example.

Identify the user with profileId. Each attribute is targeted by custom[].key.

Request body#

ParameterTypeRequiredDescription
profileIdstringRequiredBotsi profile ID from Create a Profile
customarrayRequiredAttribute objects. Must contain at least one
custom[].keystringRequiredThe attribute key to update
custom[].valuestringRequiredThe new value
curl -X PUT "https://api.botsi.com/v2/custom-attributes" \
  -H "Authorization: $BOTSI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "profileId": "0072102a-c00c-4ea5-9271-1b6e975f2d63",
    "custom": [
      { "key": "user_level", "value": "vip" },
      { "key": "subscription_type", "value": "annual" }
    ]
  }'

PUT only updates attributes that already exist

The update is atomic. If any key in custom is missing from the Profile, nothing is written and the 404 names the keys it could not find.

Create attributes with Add Custom Attributes first.

Errors#

CodeMessageCause
400custom must contain at least 1 elementsThe custom array was empty
404Custom attribute key(s) not found on profile 0072102a-c00c-4ea5-9271-1b6e975f2d63: user_level. PUT only updates existing attributes — create them with POST /v2/custom-attributes.At least one key does not exist on the Profile. Nothing was written

Response#

{
  "ok": true,
  "data": [
    { "id": "abc123", "key": "user_level", "value": "vip" },
    { "id": "def456", "key": "subscription_type", "value": "annual" }
  ]
}