Request

URL

PATCH https://www.chatbase.co/api/v1/chatbots/{chatbotId}/contacts/{contactId}

Path Parameters

chatbotId
string
required

The ID of the chatbot the contact belongs to

contactId
string
required

The ID of the contact to update

Headers

Content-Type
string
required

application/json

Authorization
string
required

Bearer <YOUR_API_KEY>

Body Parameters

data
object
required

Object containing the contact information to update

{
  "data": {
    "name": "John Smith",
    "email": "john.smith@example.com",
    "phonenumber": "+1234567890",
    "custom_attributes": {
      "age": 31,
      "location": "Los Angeles"
    }
  }
}

Response

Success Response

  • Status: 200 OK
  • Content-Type: application/json
message
string

Success message

data
Contact Object
{
  "message": "Success",
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "external_id": "kX2b8YpI-jRmN3vQ5",
    "name": "John Smith",
    "email": "john.smith@example.com",
    "phonenumber": "+1234567890",
    "custom_attributes": {
      "age": 31,
      "location": "Los Angeles"
    },
    "created_at": 1571672154,
    "updated_at": 1571672154
  }
}

Error Responses

400 Bad Request

  • Invalid request body or custom attributes
{
  "message": "Invalid request body",
  "issues": [
    {
      "field": "custom_attributes.age",
      "message": "Expected number, received string"
    }
  ]
}

401 Unauthorized

  • Invalid or missing API key
{
  "message": "Unauthorized access"
}

404 Not Found

  • Chatbot or contact not found
{
  "message": "Contact not found"
}

409 Conflict

  • Email already exists for another contact
{
  "message": "Email already exists"
}

429 Too Many Requests

  • Rate limit exceeded
{
  "message": "Rate limit exceeded"
}

Code Examples