Skip to content
Get Started
API v2

Contacts API

Create, read, update, and delete contacts via the Sendblue API, including custom variable support

Manage your contacts programmatically. The Contacts API supports full CRUD operations, tagging, assignment, and custom variables with human-readable labels.

Retrieve a paginated list of contacts for your account.

GET https://api.sendblue.co/api/v2/contacts
ParameterTypeRequiredDescription
limitintegerNoMaximum number of contacts to return
offsetintegerNoNumber of contacts to skip (default: 0)
order_bystringNoSort field: created_at (default), firstName, lastName, phone
order_directionstringNoasc or desc (default: desc)
phone_numberstringNoFilter by phone number (E.164 format)
Terminal window
curl -X GET 'https://api.sendblue.co/api/v2/contacts?limit=10&offset=0&order_by=created_at&order_direction=desc' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET'
[
{
"firstName": "John",
"lastName": "Doe",
"phone": "+14155551234",
"companyName": "[email protected]",
"tags": ["VIP", "Customer"],
"sendblueNumber": "+19175559876",
"created_at": "2024-01-15T10:30:00Z",
"assignedToEmail": "[email protected]",
"customVariables": {
"Lead Source": "Website",
"Plan": "Enterprise"
}
}
]

Retrieve a single contact by phone number.

GET https://api.sendblue.co/api/v2/contacts/:phone_number
ParameterTypeDescription
phone_numberstringPhone number in E.164 format (URL-encode + as %2B)
Terminal window
curl -X GET 'https://api.sendblue.co/api/v2/contacts/%2B14155551234' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET'
{
"status": "OK",
"contact": {
"firstName": "John",
"lastName": "Doe",
"phone": "+14155551234",
"companyName": "[email protected]",
"tags": ["VIP"],
"sendblueNumber": "+19175559876",
"created_at": "2024-01-15T10:30:00Z",
"assignedToEmail": "[email protected]",
"customVariables": {
"Lead Source": "Website"
}
}
}

Get the total number of contacts for your account.

GET https://api.sendblue.co/api/v2/contacts/count
ParameterTypeRequiredDescription
phone_numberstringNoFilter count by phone number (E.164 format)
Terminal window
curl -X GET 'https://api.sendblue.co/api/v2/contacts/count' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET'
{
"count": 142
}

Create a new contact.

POST https://api.sendblue.co/api/v2/contacts
ParameterTypeRequiredDescription
numberstringYesPhone number in E.164 format
first_namestringNoFirst name
last_namestringNoLast name
sendblue_numberstringNoAssociated Sendblue phone number
tagsstring[]NoArray of tag labels
assigned_to_emailstringNoEmail of user to assign this contact to
update_if_existsbooleanNoIf true, updates the contact if it already exists (default: false)
custom_variablesobjectNoCustom key-value pairs. Keys are human-readable labels; unknown labels are auto-created.
Terminal window
curl -X POST 'https://api.sendblue.co/api/v2/contacts' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"number": "+14155551234",
"first_name": "John",
"last_name": "Doe",
"tags": ["VIP", "Customer"],
"custom_variables": {
"Lead Source": "Website",
"Plan": "Enterprise"
}
}'
{
"status": "OK",
"contact": {
"firstName": "John",
"lastName": "Doe",
"phone": "+14155551234",
"companyName": "[email protected]",
"tags": ["VIP", "Customer"],
"customVariables": {
"Lead Source": "Website",
"Plan": "Enterprise"
}
}
}

Create multiple contacts in a single request.

POST https://api.sendblue.co/api/v2/contacts/bulk
ParameterTypeRequiredDescription
contactsarrayYesArray of contact objects

Each contact object:

FieldTypeRequiredDescription
phonestringYesPhone number in E.164 format
firstNamestringNoFirst name
lastNamestringNoLast name
companystringNoCompany name
tagsstring[]NoArray of tag labels
customVariablesobjectNoCustom key-value pairs. Keys are human-readable labels; unknown labels are auto-created.
Terminal window
curl -X POST 'https://api.sendblue.co/api/v2/contacts/bulk' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"contacts": [
{
"firstName": "John",
"lastName": "Doe",
"phone": "+14155551234",
"tags": ["VIP"],
"customVariables": {
"Lead Source": "Website"
}
},
{
"firstName": "Jane",
"lastName": "Smith",
"phone": "+14155555678",
"tags": ["Customer"],
"customVariables": {
"Lead Source": "Referral"
}
}
]
}'
{
"status": "OK",
"contacts": [
{
"firstName": "John",
"lastName": "Doe",
"phone": "+14155551234",
"tags": ["VIP"],
"customVariables": {
"Lead Source": "Website"
}
}
],
"numberOfContactsCreated": 2,
"failures": [
{
"contact": { "phone": "+invalid" },
"error": "Invalid phone number"
}
]
}

The failures array is only included if some contacts failed to create.


Update an existing contact by phone number.

PUT https://api.sendblue.co/api/v2/contacts/:phone_number
ParameterTypeDescription
phone_numberstringPhone number in E.164 format (URL-encode + as %2B)
ParameterTypeRequiredDescription
first_namestringNoFirst name
last_namestringNoLast name
sendblue_numberstringNoAssociated Sendblue phone number
assigned_to_emailstringNoEmail of user to assign this contact to
tagsstring[]NoArray of tag labels. Replaces all existing tags — pass the full desired set.
custom_variablesobjectNoCustom key-value pairs. Merged with existing variables (not replaced).
phone_numberstringNoNew phone number (if updating the phone number itself)

Important: tags are replaced entirely on update, while custom_variables are merged with existing values.

Terminal window
curl -X PUT 'https://api.sendblue.co/api/v2/contacts/%2B14155551234' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"first_name": "John",
"tags": ["VIP", "Enterprise"],
"custom_variables": {
"Plan": "Premium"
}
}'
{
"status": "OK",
"contact": {
"firstName": "John",
"lastName": "Doe",
"phone": "+14155551234",
"companyName": "[email protected]",
"tags": ["VIP", "Enterprise"],
"sendblueNumber": "+19175559876",
"assignedToEmail": "[email protected]",
"created_at": "2024-01-15T10:30:00Z",
"customVariables": {
"Lead Source": "Website",
"Plan": "Premium"
}
}
}

Delete a single contact by phone number.

DELETE https://api.sendblue.co/api/v2/contacts/:phone_number
ParameterTypeDescription
phone_numberstringPhone number in E.164 format (URL-encode + as %2B)
Terminal window
curl -X DELETE 'https://api.sendblue.co/api/v2/contacts/%2B14155551234' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET'
{
"status": "OK"
}

Delete multiple contacts by phone number.

DELETE https://api.sendblue.co/api/v2/contacts
ParameterTypeRequiredDescription
contact_idsstring[]YesArray of phone numbers in E.164 format
Terminal window
curl -X DELETE 'https://api.sendblue.co/api/v2/contacts' \
-H 'sb-api-key-id: YOUR_API_KEY' \
-H 'sb-api-secret-key: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"contact_ids": ["+14155551234", "+14155555678"]
}'
{
"status": "OK",
"amount": 2,
"total": 2,
"successes": 2,
"failures": 0
}

{
"status": "ERROR",
"message": "Missing fields"
}
{
"status": "ERROR",
"message": "Unauthorized"
}
{
"status": "ERROR",
"message": "Contact not found"
}
{
"status": "ERROR",
"message": "Contact already exists"
}

The Contacts API is rate-limited to 100 requests per 10 seconds per account.


  1. Phone Number Format: All phone numbers must be in E.164 format (e.g., +14155551234). When passing phone numbers in URL paths, URL-encode the + as %2B (e.g., %2B14155551234).

  2. Custom Variables: Keys are human-readable labels, not internal IDs. If you pass a label that doesn’t exist yet, it will be automatically created as a new custom variable definition on your account.

  3. Input Field Names: Both snake_case (custom_variables, first_name) and camelCase (customVariables, firstName) are accepted on input. Responses use camelCase.

  4. Tags vs. Custom Variables on Update: When updating a contact, tags are replaced entirely (pass the full desired set), while custom_variables are merged with existing values (only the keys you pass are updated).

  5. Authentication: All endpoints require sb-api-key-id and sb-api-secret-key headers.

  6. Rate Limits: Contacts endpoints are rate-limited to 100 requests per 10 seconds.