Delete a contact (v1)
DELETE /api/v1/chatbots/:chatbotId/contacts/:contactId — permanently delete a contact by external id. Returns the deleted record.
View as MarkdownDELETE /api/v1/chatbots/:chatbotId/contacts/:contactId
Permanently delete a contact, addressed by its external_id. The deleted record is echoed back in data so you can confirm what was removed.
Irreversible
Deleting a contact removes it and its custom-attribute values for the agent. There is no undo.
| Param | In | Type | Notes |
|---|---|---|---|
| chatbotId | path | integer | The agent id. |
| contactId | path | string | The contact's external_id. |
curl -X DELETE https://app.bookbag.ai/api/v1/chatbots/123/contacts/user_8821 \ -H "Authorization: Bearer $BOOKBAG_API_KEY"
const res = await fetch(
"https://app.bookbag.ai/api/v1/chatbots/123/contacts/user_8821",
{
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.BOOKBAG_API_KEY}` },
}
);
const { data } = await res.json();{
"message": "Success",
"data": {
"id": "contact_57",
"external_id": "user_8821",
"name": "Sam R.",
"email": "sam@acme.com",
"phonenumber": null,
"stripe_accounts": [],
"custom_attributes": { "plan": "enterprise" },
"created_at": 1717286400,
"updated_at": 1717290000
}
}Status codes
| Status | Meaning |
|---|---|
| 200 | Deleted; the removed record is returned. |
| 401 | Missing or invalid key. |
| 404 | Unknown chatbot/contact. Body: { message: "Resource not found" }. |
See Errors.