NAV Navigation
Javascript PHP

SnapCall Rest API

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

SnapCall's Rest API allows you to interact automatically with your SnapCall data on demand. With simple scripts, you can build your own analytics by retrieving calls informations and manage your SnapCall buttons list.

API key Authentication

The SnapCall API uses an API key to authenticate requests. You can view your API key in the SnapCall Dashboard.

Your API key carry many privileges, so be sure to keep it secure! Do not share your API key in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. You do not need to provide a password.

If you need to authenticate via bearer auth (e.g., for a cross-origin request), you can pass your API key as the bearer token.

All request bodies should have content type application/json and be valid JSON.

Buttons

Read all

[GET] /v2/buttons

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/buttons', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/buttons');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read all buttons

Query String

Parameter Type Required
page number false
limit number false
name string false
agent string false
active boolean false

Read

[GET] /v2/buttons/{bid}

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/buttons/bid', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/buttons/bid');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read a button

URI Components

Parameter Type Required
bid alternatives true

Info

[GET] /v2/buttons/{bid}/info

Code samples

fetch('https://api.snapcall.io/v2/buttons/bid/info')
  .then(res => res.json())
  .then(console.log);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/buttons/bid/info');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);



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

var_dump($response);

Retrieve information about a specific button

URI Components

Parameter Type Required
bid alternatives true

Create

[POST] /v2/buttons

Code samples

const apiKey = 'abc';

const options = {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    name,
    brand,
    call_id,
    schedule_template_id,
    timezone,
    caller_id,
    config,
    display_page,
    cart_value,
    active,
  }),
};

fetch('https://api.snapcall.io/v2/buttons', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/buttons');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, [
  'name' => string,
  'brand' => string,
  'call_id' => alternatives,
  'schedule_template_id' => number,
  'timezone' => string,
  'caller_id' => alternatives,
  'config' => object,
  'display_page' => string,
  'cart_value' => number,
  'active' => boolean,
]);
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Create a button

JSON Payload

Parameter Type Required
name string true
brand string false
call_id alternatives true
schedule_template_id number false
timezone string false
caller_id alternatives false
config object false
display_page string false
cart_value number false
active boolean false

Create batch

[POST] /v2/buttons/batch

Code samples

const apiKey = 'abc';

const options = {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    buttons,
  }),
};

fetch('https://api.snapcall.io/v2/buttons/batch', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/buttons/batch');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, [
  'buttons' => array,
]);
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Create multiple buttons

JSON Payload

Parameter Type Required
buttons array true

Update batch

[PUT] /v2/buttons/batch

Code samples

const apiKey = 'abc';

const options = {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    buttons,
  }),
};

fetch('https://api.snapcall.io/v2/buttons/batch', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/buttons/batch');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
  'buttons' => array,
]));
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Update multiple buttons

JSON Payload

Parameter Type Required
buttons array true

Update

[PUT] /v2/buttons/{bid}

Code samples

const apiKey = 'abc';

const options = {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    name,
    brand,
    call_id,
    schedule_template_id,
    timezone,
    caller_id,
    config,
    display_page,
    cart_value,
    active,
  }),
};

fetch('https://api.snapcall.io/v2/buttons/bid', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/buttons/bid');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
  'name' => string,
  'brand' => string,
  'call_id' => alternatives,
  'schedule_template_id' => number,
  'timezone' => string,
  'caller_id' => alternatives,
  'config' => object,
  'display_page' => string,
  'cart_value' => number,
  'active' => boolean,
]));
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Update a button

URI Components

Parameter Type Required
bid alternatives true

JSON Payload

Parameter Type Required
name string false
brand string false
call_id alternatives false
schedule_template_id number false
timezone string false
caller_id alternatives false
config object false
display_page string false
cart_value number false
active boolean false

Calls

ReadAll

[GET] /v2/calls

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/calls', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/calls');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read all calls

Query String

Parameter Type Required
page number false
limit number false
rate alternatives false
start date false
end date false
button alternatives false
status alternatives false
agent alternatives false
client alternatives false
ani number false
exporting boolean false

Read

[GET] /v2/calls/{id}

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/calls/123', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/calls/123');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read a call, given an ID

URI Components

Parameter Type Required
id number true

Schedule-templates

Read all

[GET] /v2/schedule-templates

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/schedule-templates', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/schedule-templates');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read all schedule template

Query String

Parameter Type Required
page number false

Read

[GET] /v2/schedule-templates/{id}

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/schedule-templates/123', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/schedule-templates/123');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read a schedule template

URI Components

Parameter Type Required
id number true

Create

[POST] /v2/schedule-templates

Code samples

const apiKey = 'abc';

const options = {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    name,
    schedule,
  }),
};

fetch('https://api.snapcall.io/v2/schedule-templates', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/schedule-templates');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, [
  'name' => string,
  'schedule' => array,
]);
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Create a schedule template

JSON Payload

Parameter Type Required
name string true
schedule array true

Update

[PUT] /v2/schedule-templates/{id}

Code samples

const apiKey = 'abc';

const options = {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    name,
    schedule,
  }),
};

fetch('https://api.snapcall.io/v2/schedule-templates/123', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/schedule-templates/123');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
  'name' => string,
  'schedule' => array,
]));
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Update a schedule template

URI Components

Parameter Type Required
id number true

JSON Payload

Parameter Type Required
name string false
schedule array false

Agents

Read

[GET] /v2/agents/{email}

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/agents/hello', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/agents/hello');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read an agent

URI Components

Parameter Type Required
email string true

Read

[GET] /v2/agents/{email}/info

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/agents/hello/info', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/agents/hello/info');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read an agent

URI Components

Parameter Type Required
email string true

Update

[PUT] /v2/agents/{email}

Code samples

const apiKey = 'abc';

const options = {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    wrap_up_time,
    last_bridge_end,
  }),
};

fetch('https://api.snapcall.io/v2/agents/hello', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/agents/hello');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
  'wrap_up_time' => number,
  'last_bridge_end' => number,
]));
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Update an agent

URI Components

Parameter Type Required
email string true

JSON Payload

Parameter Type Required
wrap_up_time number false
last_bridge_end number false

Status

[PUT] /v2/agents/{email}/status

Code samples

const apiKey = 'abc';

const options = {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  body: JSON.stringify({
    status,
  }),
};

fetch('https://api.snapcall.io/v2/agents/hello/status', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/agents/hello/status');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
  'status' => string,
]));
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Update the status of an agent

URI Components

Parameter Type Required
email string true

JSON Payload

Parameter Type Required
status string true

Users

Me

[GET] /v2/users/me

Code samples

const apiKey = 'abc';

const options = {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
};

fetch('https://api.snapcall.io/v2/users/me', options)
  .then(res => res.json())
  .then(console.log);
$api_key = 'abc';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/users/me');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  "Authorization: Bearer {$api_key}",
]);


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

var_dump($response);

Read the authenticated user

Button

[POST] /v2/users/{id}/button

Code samples

const options = {
  method: 'POST',
  body: JSON.stringify({
    referer,
    cart_value,
  }),
};

fetch('https://api.snapcall.io/v2/users/123/button', options)
  .then(res => res.json())
  .then(console.log);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.snapcall.io/v2/users/123/button');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, [
  'referer' => string,
  'cart_value' => number,
]);
$response = curl_exec($curl);
curl_close($curl);

var_dump($response);

Return a button passing every display filters

URI Components

Parameter Type Required
id number true

JSON Payload

Parameter Type Required
referer string true
cart_value number false