Developer Docs

Table of contents

The BSG API provides you an opportunity to manage contacts for subsequent single and multiple uses when conducting SMS, Viber, or Number Verification campaigns. You can create new contacts, view, edit, group, delete existing contacts.

Edit contact

The method allows you to make changes to an existing contact: change the phone number, data in the contact’s custom fields, and add the contact to the list.

Please note that in the TEST account mode there is a restriction for performing this method: you can only change the contact’s phone number to a verified number (number verification is performed in the personal account at the BSG platform).

To edit, make a request to this URL:

PUT http://one-api.bsg.world/api/contacts/{id}

Request parameters

ParameterRequiredTypeDescription 
idYesintegerID of a contact to be changed
phoneYesintegerContact’s phone number.Value in ITU format. 9 to 15 digits.
groupsNoarrayID array of the contact list to add the contact to.
fieldsNoarrayOther data in custom contact fields
idintegerContact custom field ID
valuestringValue for the custom contact field

Request example:

{
  "phone": 85267202829,
  "groups": [
    1
  ],
  "fields": [
    {
      "id": 25964,
      "value": "TARAS SHEVCHENKO"
    }
  ]
}

Response parameters

ParameterTypeDescription 
idintegerContact ID for which the query was made.
phoneintegerContact phone number.
fieldsarrayContains embedded custom fields data
idintegerCustom field ID.
valuestringCustom field data.
created_atdatetimeDate when the contact was created in the system ― set by the system automatically when a contact is added to the Contact Book. Display format ― Y-m-d H:i:s
groupsarrayContains embedded data of the list where the contact is added.
idstringID of a list (generated automatically when creating a contact list) where the contact is added.
namestringName of the list where the contact is added.
descriptionstringDescription списка where the contact is added.
defaultboolIndicates whether the contact list is a default one.
created_atdatetimeCreation date of the list where the contact is added. Display format ― Y-m-d H:i:s
hlr_statusstringStatus of the contact phone number verification in the HLR database. Possible values: sent, absent, active, unknown, failed.
hlr_last_checkstringDate and time when the contact’s phone number was last verified against the HLR database. Display format ― Y-m-d H:i:s

If the request is successful, you will receive a response:

{
  "data": {
    "id": 1,
    "phone": 85267202829,
    "fields": {
      "additionalProp1": "string",
      "additionalProp2": "string",
      "additionalProp3": "string"
    },
    "created_at": "2022-04-28 14:21:16",
    "groups": [
      {
        "id": 1,
        "name": "string",
        "description": "string",
        "default": 0,
        "created_at": "2022-04-28 14:21:16"
      }
    ],
    "hlr_status": "string",
    "hlr_last_check": "2022-04-28 14:21:16"
  }
}