BookbagBookbag

List & get contacts (v1)

GET /api/v1/chatbots/:chatbotId/contacts to list (paged) and GET /api/v1/chatbots/:chatbotId/contacts/:contactId to fetch one by external id.

View as Markdown

GET /api/v1/chatbots/:chatbotId/contacts

List contacts for an agent. Page-based pagination, returned in a pages object alongside the total. contactId in the single-get path is the contact's external_id.

ParamInTypeNotes
chatbotIdpathintegerThe agent id.
pagequeryintegerPage number (default 1).
per_pagequeryintegerItems per page. Clamped to 10–1000, default 100.
curl "https://app.bookbag.ai/api/v1/chatbots/123/contacts?page=1&per_page=50" \
  -H "Authorization: Bearer $BOOKBAG_API_KEY"
const res = await fetch(
  "https://app.bookbag.ai/api/v1/chatbots/123/contacts?page=1&per_page=50",
  { headers: { Authorization: `Bearer ${process.env.BOOKBAG_API_KEY}` } }
);
const { data, total, pages } = await res.json();
{
  "message": "Success",
  "data": [
    {
      "id": "contact_57",
      "external_id": "user_8821",
      "name": "Sam Rivera",
      "email": "sam@acme.com",
      "phonenumber": null,
      "stripe_accounts": [],
      "custom_attributes": { "plan": "pro" },
      "created_at": 1717286400,
      "updated_at": 1717286400
    }
  ],
  "total": 1,
  "pages": { "page": 1, "per_page": 50, "total_pages": 1 }
}

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

Fetch a single contact by its external_id.

ParamInTypeNotes
chatbotIdpathintegerThe agent id.
contactIdpathstringThe contact's external_id.
curl https://app.bookbag.ai/api/v1/chatbots/123/contacts/user_8821 \
  -H "Authorization: Bearer $BOOKBAG_API_KEY"
{
  "message": "Success",
  "data": {
    "id": "contact_57",
    "external_id": "user_8821",
    "name": "Sam Rivera",
    "email": "sam@acme.com",
    "phonenumber": null,
    "stripe_accounts": [],
    "custom_attributes": { "plan": "pro" },
    "created_at": 1717286400,
    "updated_at": 1717286400
  }
}

Status codes

StatusMeaning
200Success.
401Missing or invalid key.
404Unknown chatbot/contact, or out of scope. Body: { message: "Resource not found" }.

See Errors.