Update Custom Attributes
PUT https://api.botsi.com/v2/custom-attributesUpdate existing attribute values, as when a user upgrades from premium to vip, for example.
This route accepts $BOTSI_SECRET_KEY or $BOTSI_PUBLIC_KEY in the Authorization header, with no Bearer prefix. The sample sends the secret key. From inside the app, send the public key. Delete a Profile is the exception and accepts the secret key only. See Authentication.
Identify the user with profileId. Each attribute is targeted by custom[].key.
Request body#
# Authorization: $BOTSI_SECRET_KEY or $BOTSI_PUBLIC_KEY
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. Multi-select keys use the same <question>.<option> format described under Multi-select answers, and a key not yet saved returns 404, so first-time answers go through POST.
Errors#
Response#
{
"ok": true,
"data": [
{ "id": "abc123", "key": "user_level", "value": "vip" },
{ "id": "def456", "key": "subscription_type", "value": "annual" }
]
}