Skip to content

Retrieves a list of site number blocks.

Method get.site_blocks
Description Retrieves a list of site number blocks.
Who has access Agents and clients

Request parameters

Name Type Required Description
access_token string yes Access token used to authenticate the request.
user_id number no Unique ID of the client user on whose behalf the agent is making the request. Required for agents. To retrieve a list of client users, use "get.customer_users".
limit number no Maximum number of records to return. See the "Paging" section.
offset number no Number of records to skip before returning results. Default: 0. See the "Paging" section.
filter object no Filtering criteria. See the "Filters" section.
fields array no Fields to include in the response. See the "Viewing returned data" section.
sort array no Sorting criteria. See the "Data sorting" section.

Response parameters

Name Type Valid values Filtering Sorting Description
id number yes Unique site number block ID.
name string yes Site number block name.
site_id number yes yes Unique site ID.
site_domain_name string yes Site domain name, without the http:// or https:// protocol prefix.
Number replacement templates
templates array Number replacement templates configured for the block.
template_id number Unique template ID.
template_type enum
  • image
  • text
Template display type:
image - Displays the number as an image
text - Displays the number as text
element_attribute enum
  • id
  • class
  • name
  • selector
  • phone_number
Attribute used to identify the element to replace on the site page:
id - HTML id attribute
class - HTML class attribute
name - HTML name attribute
selector - CSS selector
phone_number - Phone number displayed on the site
element_attribute_value string Value of the selected element attribute.
phone_number_template string Display template used when template_type is text. The template can contain arbitrary text and the following placeholders: {country} - country code; {city} - area code; {phone} - local phone number.
phone_number_mask string Display mask for {phone} when template_type is text. Use # for digits. The mask may contain 5 to 7 digit placeholders and is applied from right to left, so additional or missing digits affect the first group. For example, ##-##-## displays 123456 as 12-34-56, 1234567 as 123-45-67, and 12345 as 1-23-45. See phone_number_template.
Virtual numbers and advertising campaigns
phone_numbers array yes Virtual numbers assigned to the block through advertising campaign settings.
phone_number string Virtual number.
phone_number_id number Unique virtual number ID.
campaign_id number Unique ID of the advertising campaign in which the block is configured for automatic number selection.
campaign_name string Name of the advertising campaign in which the block is configured for automatic number selection.
image_url string Image URL when template_type is image.

Example request

{
  "jsonrpc": "2.0",
  "id": "number",
  "method": "get.site_blocks",
  "params": {
    "access_token": "string",
    "user_id": "number",
    "offset": "number",
    "limit": "number",
    "filter": {},
    "sort": [
      {
        "field": "string",
        "order": "string"
      }
    ],
    "fields": [
      "string"
    ]
  }
}

Example response

{
  "jsonrpc": "2.0",
  "id": "number",
  "result": {
    "metadata": {},
    "data": [
      {
        "id": "number",
        "site_id": "number",
        "site_domain_name": "string",
        "templates": [
          {
            "template_id": "number",
            "template_type": "enum",
            "element_attribute": "enum",
            "element_attribute_value": "string",
            "phone_number_template": "string",
            "phone_number_mask": "string"
          }
        ],
        "phone_numbers": [
          {
            "phone_number": "string",
            "phone_number_id": "number",
            "campaign_id": "number",
            "campaign_name": "string",
            "image_url": "string"
          }
        ]
      }
    ]
  }
}

Possible errors

See the "Errors for get methods" section.