BookbagBookbag

Custom attributes (v1)

List, create, and update the custom attribute definitions for an agent: GET/POST /api/v1/chatbots/:chatbotId/custom-attributes and PUT /:name.

View as Markdown

Custom attributes define the extra fields you can store on contacts (for example plan or ltv). These endpoints manage the definitions; the values live on each contact's custom_attributes object. All paths are authenticated with Authorization: Bearer oc_... and chatbotId is your agent id.

GET /api/v1/chatbots/:chatbotId/custom-attributes

List the attribute definitions for an agent.

curl https://app.bookbag.ai/api/v1/chatbots/123/custom-attributes \
  -H "Authorization: Bearer $BOOKBAG_API_KEY"

POST /api/v1/chatbots/:chatbotId/custom-attributes

Create an attribute definition.

FieldTypeRequiredNotes
namestringYesMust start with a letter; letters, numbers, underscores, hyphens only. Unique per agent.
labelstringNoDisplay label. Defaults to name.
typestringNoOne of text, number, boolean, date. Defaults to text.
descriptionstringNoFree-text help.
archivedbooleanNoCreate it archived (hidden from the contact UI).
curl https://app.bookbag.ai/api/v1/chatbots/123/custom-attributes \
  -H "Authorization: Bearer $BOOKBAG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "ltv", "label": "Lifetime value", "type": "number" }'

PUT /api/v1/chatbots/:chatbotId/custom-attributes/:name

Update an attribute definition by name. You can change label, description, and archived. The name and type are fixed once created.

FieldInTypeNotes
namepathstringThe attribute name.
labelbodystringNew display label.
descriptionbodystringNew description.
archivedbodybooleanArchive or unarchive.
curl -X PUT https://app.bookbag.ai/api/v1/chatbots/123/custom-attributes/ltv \
  -H "Authorization: Bearer $BOOKBAG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "label": "LTV (USD)", "archived": true }'

Status codes

StatusMeaning
200Success.
400Invalid name or type. Body: { message } describing the rule.
401Missing or invalid key.
404Unknown chatbot/attribute. Body: { message: "Resource not found" }.
409An attribute with that name already exists. Body: { message: "Attribute already exists" }.

See Errors.