BookbagBookbag

Update a contact (v1)

PATCH /api/v1/chatbots/:chatbotId/contacts/:contactId — update a contact by external id. Accepts a Chatbase-style { data: {...} } wrapper or a bare body.

View as Markdown

PATCH /api/v1/chatbots/:chatbotId/contacts/:contactId

Update an existing contact, addressed by its external_id. Only the fields you send are changed. Sending null for name, email, or phonenumber clears it. For Chatbase compatibility the body may be wrapped in { "data": { ... } }, or sent bare.

Auth & ids

Authenticate with Authorization: Bearer oc_.... chatbotId is your agent id; contactId is the contact's external_id.

Path & body

FieldInTypeNotes
chatbotIdpathintegerThe agent id.
contactIdpathstringThe contact's current external_id.
external_idbodystringChange the external id. Must be unique for the agent or you get 409.
namebodystring|nullNew name, or null to clear.
emailbodystring|nullNew email, or null to clear.
phonenumberbodystring|nullNew phone, or null to clear.
stripe_accountsbodyarrayReplaces the array.
custom_attributesbodyobjectReplaces the custom-attributes object.
curl -X PATCH https://app.bookbag.ai/api/v1/chatbots/123/contacts/user_8821 \
  -H "Authorization: Bearer $BOOKBAG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "data": { "name": "Sam R.", "custom_attributes": { "plan": "enterprise" } } }'

Status codes

StatusMeaning
200Updated.
401Missing or invalid key.
404Unknown chatbot/contact. Body: { message: "Resource not found" }.
409New external_id conflicts. Body: { message: "Error saving chatbot contact. External ID or email already exists." }.

See Errors.