Add Single Custom Attribute

POSThttps://app.botsi.com/api/v1/web-api/profiles/custom-attributes

Creates a single custom attribute for a profile.

Follow the notes below for a successful request:
  • Use custom attributes to enrich a user profile with application-specific metadata (for example: user tier, referral source, or segmentation labels). This is optional for the core AI Pricing flow.

  • Identify the user by providing either customerUserId or profileId. At least one is required to return the correct result.

    A successful request returns the newly created custom attribute. The returned id represents the custom attribute ID and can be used later to update this attribute.

Request Body

application/json

ParameterTypeRequiredDescription
profileIdstringOptionalBotsi profile ID. Provide either profileId or customerUserId
customerUserIdstringRecommendedYour internal user ID. Provide either profileId or customerUserId
customobjectRequiredCustom attribute object
keystringRequiredThe attribute key. Example: user_level
valuestringRequiredThe attribute value. Example: premium

Example Request

{
  "profileId": "0072102a-c00c-4ea5-9271-1b6e975f2d63",
  "custom": {
    "key": "user_level",
    "value": "premium"
  }
}

cURL Example

curl -X POST "https://app.botsi.com/api/v1/web-api/profiles/custom-attributes"      -H "Authorization: {{secret_key}}"      -H "Content-Type: application/json"      -d '{
       "profileId": "0072102a-c00c-4ea5-9271-1b6e975f2d63",
       "custom": {
         "key": "user_level",
         "value": "premium"
       }
     }'

Response

200Attribute created successfully
{
  "ok": true,
  "data": {
    "id": "yFtuWhuj",
    "key": "user_level",
    "value": "premium"
  }
}

Try It Out

https://app.botsi.com/api/v1/web-api
Response
Click "Send API Request" to see the response here.