Update Contact Group

PATCH/api/v2/contact-groups/update

Base URL https://api.easify.liveBearer token and Accept header required Authentication →

This endpoint is used to update a contact group.

The user can update the contact group with a new name or make corrections to the existing name.

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

name string Specify the name for the contact group required
group_id integer The specific contact group ID for update (The group ID will be obtained from the contact-groups API response) required
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:

{
  "group_id": 1,
  "name": "Updated Contact Group Name"
}

Success Response:

{
  "status": true,
  "message":
   "Contact Group updated successfully",
  "data": {
    "id": 1,
    "name": "Updated Contact Group Name ",
    "contacts_count": 0,
    "shared_group": false,
    "default_group": false,
    "created_at": "09-05-2024 07:27:18 AM"
  }
}
  • The contacts_count in the response refers to the total number of contacts in the specific contact group.
  • The shared_group is a Boolean field that specifies whether the contact group is the main user's shared contact group or not.
  • The default_group is a Boolean field that indicates whether the contact group is the user's default contact group in the Easify app

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 provides the name of an existing contact group 422 { "message": "The name has already been taken.", "errors": { "name": ["The name has already been taken."] } }
If user did not provide the group_id 422 { "message": "The group id field is required.","errors": { group_id": "The group id field is required."] } }
If user did not provide invalid group_id 400 { "status": false, "message": "Invalid group id", "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 group
php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://api.easify.live/api/v2/contact-groups/update?name=Updated%20Contact%20Group%20Name&group_id=1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PATCH',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <>',
    'Accept: application/json',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;