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 MarkdownPATCH /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
| Field | In | Type | Notes |
|---|---|---|---|
| chatbotId | path | integer | The agent id. |
| contactId | path | string | The contact's current external_id. |
| external_id | body | string | Change the external id. Must be unique for the agent or you get 409. |
| name | body | string|null | New name, or null to clear. |
| body | string|null | New email, or null to clear. | |
| phonenumber | body | string|null | New phone, or null to clear. |
| stripe_accounts | body | array | Replaces the array. |
| custom_attributes | body | object | Replaces 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
| Status | Meaning |
|---|---|
| 200 | Updated. |
| 401 | Missing or invalid key. |
| 404 | Unknown chatbot/contact. Body: { message: "Resource not found" }. |
| 409 | New external_id conflicts. Body: { message: "Error saving chatbot contact. External ID or email already exists." }. |
See Errors.