Update Contact
PATCH
/api/v2/contacts/update Base URL https://api.easify.liveBearer token and Accept header required Authentication →
This endpoint is used to update a contact.
The user can update the contact with new values or make corrections to existing values by providing the specific contact's ID
There is a rate limit of 60 requests per minute per API token. This limit is shared by all API endpoints except those with their own separate limit (/api/v2/sms/send, /api/v3/sms/send, etc.), so requests to other endpoints also count toward it. If you exceed this limit, you will receive a 429 Too Many Requests status, along with a message indicating when you can try again.
Query Parameters
| contact_id integer | The specific contact ID for update (The contactID will be obtained from the contacts API response) | Required |
| first_name string | First name for the contact (Maximum 20 characters are allowed) | Required |
| last_name string | Last name for the contact (Maximum 20 characters are allowed) | Optional |
| email_address integer | Email Address for the contact |
Required
without PhoneNumber
|
| country_code string | Specific country code for the phone number (e.g.,+1 for US/Canada and +972 for Israel). |
Required
with PhoneNumber
|
| phone_number string | Phone number for the contact (US/Canada numbers must be 10 digits, and Israel numbers must be 9 digits). |
Required
without Email
|
| company string | Company name for the contact | Optional |
| additional_1 string | Additional fields for the contact | Optional |
| additional_2 string | Additional fields for the contact | Optional |
| additional_3 string | Additional fields for the contact | Optional |
All parameters should be URL encoded to ensure they are correctly transmitted. For example, the + character must be encoded as %2B
Example Request and Response
params
{
"sms_api_token": "<> ",
"contact_id": 1,
"first_name": "Contact",
"last_name": "Easify",
"phone_number": "773638****",
"country_code": "+1",
"email_address": "easify@easify.app"
}
Success Response:
{
"status": true,
"message": "Contact updated successfully",
"data": {
"id": 1,
"group_name": "My Contact Group",
"first_name": "Easify",
"last_name": "App",
"phone_number": "+773638****",
"email_address": "easify@app.com",
"company": "company",
"additional_1": "ad",
"additional_2": "d",
"additional_3": "d",
"shared_contact": true,
"created_at": "12-02-2024 03:34:30 AM",
"updated_at": "12-03-2024 12:12:10 AM"
}
}
- The shared_contact is a Boolean field that indicates whether the contact is in the main user's shared contact group
Responses
| Case | Status Code | Response |
|---|---|---|
| If the user does not provide a token in the header or provides an invalid token | 401 |
{
"status":false,
"message":"Unauthenticated",
"errors":[]
}
|
| If the user did not provide the contact_id | 422 |
{
"message": "The contact id field is required.",
"errors": {
"contact_id": ["The contact id field is required."]
}
}
|
| If the user provides invalid contact_id | 400 |
{
"status": false,
"message": "Invalid contact id",
"errors": []
}
|
| If the tries to update with an existing phone number in the same contact group | 422 |
{
"message": "The phone number already exists",
"errors": {
"phone_number": "The phone number already exists"
}
}
|
| If the user provides an invalid country code | 422 |
{
"message":"Currently, this service is only available in the following countries: Canada, United States, Israel, United Kingdom. Please verify the country code.","errors": {"country_code":["Currently, this service is only available in the following countries: Canada, United States, Israel, United Kingdom. Please verify the country code."]
}
}
|
| If the sub user tries to update a contact from a shared contact group. | 400 |
{
"status": false,"message":
"You cannot update a contact from a shared contact group",
"errors": []}
|
| If the user exceeds the allowed rate limit for requests | 429 |
{
"status":false,
"message":"Too many requests. Try again in 59 seconds",
"errors":[]
}
|
| If the user's subscription has ended | 402 |
{
"status":false,"message":"You need to recharge your account to proceed","errors":[]
}
|
| When the user account is inactive | 403 |
{
"status": false,
"message": "Your account is currently inactive.",
"errors": []
}
|
| If the request comes from an IP address or domain that is not on the account's API whitelist | 400 |
{
"status": false,
"message": "Access denied! Your IP or domain is not whitelisted.[ HostName : ] - [ Ip Address : << YOUR_SERVER_IP >>]",
"errors": []
}
|
Code Examples
Update a contact
php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.easify.live/api/v2/contacts/update?contact_id=1&first_name=Contact&last_name=Easify&email_address=easify@easify.app&country_code=%2B1&phone_number=773638****',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <> ',
'Accept: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;