Введение
Это страница документации API KWIGA. С помощью данного API вы имеете возможностью производить некоторые действия в от своего имени в определённых кабинетах.
Для того чтобы включить API, в личном кабинете в разделе settings нужно нажать на соответсвующий чекбокс. После этого будет сгенерирован токен для API и получен хеш кабинета, которые нужны для последующих обращений к API.
При компрометации токена его можно перевыпустить, что сделает прошлый токен неактивным и сгенерирует новый.
API доступен только для тех пользователей у кого в кабинете включено API.
API имеет ограничение на количество обращений в секунду. Сейчас доступно 1 обращение в секунду.
Базовая работа с API
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$id = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/' . $id);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/contacts/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Все запросы должны отправляться на домен:
https://api.kwiga.com
Для авторизации передаём API-токен в одном из вариантов:
в заголовках:
Token: {token}
в GET/POST параметрах:
token={token}
Для идентификации кабинета, в котором происходят действия, обязательно передаём хеш-кабинета в одном из вариантов:
в заголовках:
Cabinet-Hash: {cabinet_hash}
в GET/POST параметрах:
cabinet_hash={cabinet_hash}
Установить локализацию справочников и сообщений валидации можно заголовком:
X-Language: {locale}
Locale | Description |
---|---|
en | English (default) |
uk | Ukrainian |
ru | Russian |
it | Italian |
es | Spanish |
de | German |
pl | Polish |
Ошибки
Код ошибки | Значение |
---|---|
400 | Bad Request - Ваш запрос неверен. |
401 | Unauthorized - Ошибка авторизации. Ваш API-ключ неверен. |
403 | Forbidden - Запрошенный ресурс спрятан и доступен только администраторам. |
404 | Not Found - Не найдено. Указанная страница не найдена. |
405 | Method Not Allowed - Метод не разрешен. Серверу известен метод запроса, но целевой ресурс не поддерживает этот метод. |
406 | Not Acceptable - Не принято. Вы запросили формат, отличный от json. |
410 | Gone - Запрошенный ресурс удален с нашего сервера. |
422 | Unprocessable entity - Сущность невозможно обработать. |
429 | Too Many Requests - Очень много запросов. Вы отправляете слишком много запросов, остановитесь! |
500 | Internal Server Error - Внутренняя ошибка сервера. Проблема с нашим сервером. Повторите попытку позже. |
503 | Service Unavailable - Сервис недоступен. Мы временно отключены от сети в связи с техническим обслуживанием. Повторите попытку позже. |
CRM. Контакты
Список контактов
Пример запроса:
<?php
// Запрос без параметров
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
<?php
// Запрос с пагинацией
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts?page=1&per_page=15');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
<?php
// Запрос с пагинацией и фильтрацией
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts?page=1&per_page=15&filters[date_from]=2022-04-27&filters[search]=example.com&with_offers=1');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/contacts' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
curl --location --request GET 'https://api.kwiga.com/contacts?page=1&per_page=15' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
curl --location --request GET 'https://api.kwiga.com/contacts?page=1&per_page=15&filters[date_from]=2022-04-27&filters[search]=example.com&with_offers=1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": [
{
"id": 1,
"created_at": "2022-02-04T12:17:32.000000Z",
"email": "test@example.com",
"first_name": "James",
"last_name": "Bond",
"phone": "+380931234567",
"tags": [
{
"id": 93,
"name": "test-tag"
}
],
"offers": [
{
"id": 8,
"unique_offer_code": "ptJmPPXVYs0t",
"title": "Предложение #8",
"limit_type": {
"id": 1,
"name": "Неограничено"
},
"limit_of_sales": null
}
]
},
{
"id": 2,
"created_at": "2022-02-04T12:17:32.000000Z",
"email": "test2@example.com",
"first_name": "Petr",
"last_name": "Ivanov",
"phone": "+380983234512",
"tags": [],
"offers": []
}
],
"links": {
"first": "https://api.kwiga.com/contacts?page=1",
"last": "https://api.kwiga.com/contacts?page=2",
"prev": null,
"next": "https://api.kwiga.com/contacts?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 2,
"links": [
{
"url": null,
"label": "« Предыдущая",
"active": false
},
{
"url": "https://api.kwiga.com/contacts?page=1",
"label": "1",
"active": true
},
{
"url": "https://api.kwiga.com/contacts?page=2",
"label": "2",
"active": false
},
{
"url": "https://api.kwiga.com/contacts?page=2",
"label": "Следующая »",
"active": false
}
],
"path": "https://api.kwiga.com/contacts",
"per_page": 15,
"to": 2,
"total": 3
}
}
HTTP Request
GET https://api.kwiga.com/contacts
URL Parameters
Parameter | Description |
---|---|
page (integer) |
Номер страницы |
per_page (integer) |
Кол-во элементов выборки |
filters[is_active] (integer) |
Фильтр по активных контактам |
filters[date_from] (2023-08-30/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Фильтр по дате создания. Параметр 'от' |
filters[date_to] (2023-08-31/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Фильтр по дате создания. Параметр 'до' |
filters[last_activity_from] (2023-08-30/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Фильтр по дате последней активность. Параметр 'от' |
filters[last_activity_to] (2023-08-31/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Фильтр по дате последней активность. Параметр 'до' |
filters[search] (string) |
Фильтр по email, телефону, ФИО |
with_offers (boolean) |
Дополнительно получить информацию по предложениям контакта |
with_orders (boolean) |
Дополнительно получить информацию по заказам контакта |
Получение контакта
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$id = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/' . $id);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/contacts/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": {
"id": 1,
"email": "test@example.com",
"first_name": "James",
"last_name": "Bond",
"phone_number": "+380931234567",
"created_at": "2023-05-26T09:47:20.000000Z",
"last_activity_at": "2023-08-10T13:23:22.000000Z",
"tags": [
{
"id": 93,
"name": "test-tag"
}
],
"first_visit": {
"id": 58,
"ip": "172.22.0.1",
"landing_url": "https://sample.kwiga.com",
"landing_domain": "https://sample.kwiga.com",
"landing_path": "/",
"landing_params": "",
"referrer_domain": null,
"referrer_url": "",
"utm_source": null,
"utm_campaign": null,
"utm_medium": null,
"utm_term": null,
"utm_content": null,
"created_at": "2023-05-26T10:51:03.000000Z"
},
"utm_visits": [
{
"id": 344,
"ip": "172.18.0.1",
"landing_url": "https://sample.kwiga.com/course/welcome-course/?utm_term=utm-test",
"landing_domain": "sample.kwiga.com",
"landing_path": "course/welcome-course",
"landing_params": "utm_term=utm-test",
"referrer_domain": null,
"referrer_url": "",
"utm_source": null,
"utm_campaign": null,
"utm_medium": null,
"utm_term": "utm-test",
"utm_content": null,
"created_at": "2023-05-31T17:25:23.000000Z"
},
],
"offers": [
{
"id": 15,
"unique_offer_code": "QphS1o8gkcRf",
"title": "Offer #15",
"limit_type": {
"id": 1,
"name": "Unlimited"
},
"limit_of_sales": null
},
],
"orders": [
{
"id": 1,
"type_id": 1,
"first_paid_at": "2023-05-26T11:25:30.000000Z",
"paid_at": "2023-05-26T11:25:30.000000Z",
"created_at": "2023-05-26T11:25:29.000000Z",
"updated_at": "2023-05-26T11:25:30.000000Z",
"products": [
{
"id": 2,
"productable_id": 1,
"productable_type": "course",
"title": "Welcome course",
"link": "https://sample.kwiga.com/course/welcome-course"
}
],
"payments": [
{
"id": 5,
"status": 2,
"status_title": "Paid",
"payment_type": null,
"payment_type_title": null,
"payment_form": null,
"payment_form_title": null,
"price_info": {
"amount": 0,
"currency": {
"id": 147,
"code": "UAH",
"html_code": "₴",
"html_letter_code": "грн"
}
},
"paid_at": "2023-05-26T11:25:29.000000Z",
"created_at": "2023-05-26T11:25:29.000000Z",
"updated_at": "2023-05-26T11:25:30.000000Z",
"transactions": [
{
"id": 28,
"merchant_id": 2,
"payment_id": 5,
"order_id": 1,
"payment_system_status": "Declined",
"failure_reason": "Cardholder session expired",
"price": "147",
"currency_code": "UAH",
"payer_account": null,
"card_mask": null,
"rrn": null,
"fee": null,
"created_at": "2023-11-03T08:45:10.000000Z"
},
{
"id": 29,
"merchant_id": 2,
"payment_id": 5,
"order_id": 1,
"payment_system_status": "Approved",
"failure_reason": null,
"price": "147",
"currency_code": "UAH",
"payer_account": "JKNNASWTZ99SJ",
"card_mask": "53****2144",
"rrn": 330710335365,
"fee": null,
"created_at": "2023-11-03T08:48:10.000000Z"
}
]
}
],
"paid_status": "paid",
"paid_status_title": "Paid",
"order_stage": {
"id": 2,
"title": "In progress",
"order_group": {
"id": 2,
"slug": "in_progress",
"title": "In progress",
"order": 2,
"created_at": "2023-05-26T09:47:16.000000Z"
},
"order_funnel": null,
"created_at": "2023-05-26T09:47:16.000000Z"
},
"cost_info": {
"amount": 0,
"currency": {
"id": 147,
"code": "UAH",
"html_code": "₴",
"html_letter_code": "грн"
}
},
"managers": [
{
"id": 264,
"name": "Manager 1",
"email": "manager1@test.com"
},
{
"id": 288,
"name": "Manager 2",
"email": "manager2@test.com"
}
]
}
],
"additional_fields": [
{
"id": 1,
"field": {
"id": 17,
"title": "test global field",
"is_local": false
},
"value": "value of global field"
}
]
}
}
HTTP Request
GET https://api.kwiga.com/contacts/{id}
Создание контакта
Пример запроса:
$headers = [
'Accept: application/json',
'Content-Type: application/x-www-form-urlencoded',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$data = [
'first_name' => 'James',
'last_name' => 'Bond',
'email' => 'bond@example.com',
'phone' => '+380931234567',
'tags' => ['tag1'],
'send_activation_email' => true,
'additional_fields' => [
[
'field_id' => 17,
'value' => 'this is test value'
]
]
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$result = json_decode($response);
curl --location --request POST 'https://api.kwiga.com/contacts' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"first_name": "James",
"last_name": "Bond",
"email": "bond@example.com",
"send_activation_email": true,
"phone": "+380931234567",
"manager_ids": [
264,
288
],
"additional_fields": [
{
"field_id": 17,
"value": "this is test value"
}
]
}'
Пример ответа:
{
"data": {
"id": 132,
"email": "bond@example.com",
"first_name": "James",
"last_name": "Bond",
"phone_number": "931234567",
"tags": [],
"created_at": "2023-06-26T19:01:00.000000Z",
"additional_fields": [
{
"id": 110,
"field": {
"id": 17,
"title": "test global",
"is_local": false
},
"value": "this is test value"
}
]
}
}
HTTP Request
POST https://api.kwiga.com/contacts
Request
Parameter | Description |
---|---|
email (string) (required) |
Email - должен быть уникальным в рамках кабинета |
phone (string) |
Номер телефона - формат: +{код страны}{телефон} Пример: +380930123456 |
first_name (string) |
Имя |
last_name (string) |
Фамилия |
tags (string[]) |
Теги |
send_activation_email (boolean) |
Отправить приветственное письмо |
locale (string) |
Язык контакта в формате iso_2 Допустимые варианты: en (по умолчанию), uk , ru |
create_order (boolean) |
Создать пустой заказ |
order_stage_id (integer) |
Идентификатор статуса заказа в воронке (можно получить на странице CRM->Заказы->Настройки->Список статусов) |
additional_fields (array) |
Пользовательские (кастомные) поля |
additional_fields[][field_id] (integer) |
id пользовательского поля (можно получить в CRM->Контакты->Настройки->Добавление пользовательских полей) |
additional_fields[][value] (null,string,integer) |
Значение пользовательского поля |
Добавить покупку
Этот метод создаёт или находит контакт и добавляет ему покупку предложения
Пример запроса:
$headers = [
'Accept: application/json',
'Content-Type: application/x-www-form-urlencoded',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$data = [
'first_name' => 'James',
'last_name' => 'Bond',
'email' => 'bond@example.com',
'phone' => '+380931234567',
'send_activation_email' => true,
'send_product_access_email' => true,
'locale' => 'uk',
'offer_id' => 18,
'manager_ids' => [264, 288],
'additional_fields' => [
[
'field_id' => 17,
'value' => 'this is test value'
]
]
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/purchases');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$result = json_decode($response);
curl --location --request POST 'https://api.kwiga.com/contacts/purchases' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"first_name": "James",
"last_name": "Bond",
"email": "bond@example.com",
"send_activation_email": true,
"phone": "+380931234567",
"offer_id": 18,
"additional_fields": [
{
"field_id": 17,
"value": "this is test value"
}
]
}'
Пример ответа:
{
"data": {
"id": 132,
"email": "bond@example.com",
"first_name": "James",
"last_name": "Bond",
"phone_number": "931234567",
"tags": [],
"created_at": "2023-06-26T19:01:00.000000Z",
"additional_fields": [
{
"id": 110,
"field": {
"id": 17,
"title": "test global",
"is_local": false
},
"value": "this is test value"
}
],
"orders": [
{
"id": 1060,
"type_id": 1,
"first_paid_at": "2023-10-13T18:04:02.000000Z",
"paid_at": "2023-10-13T18:04:02.000000Z",
"created_at": "2023-10-13T18:04:02.000000Z",
"updated_at": "2023-10-13T18:04:02.000000Z",
"products": [
{
"id": 25,
"productable_id": 10,
"productable_type": "course",
"title": "test course",
"link": "https://sample-school.kwiga.com/courses/test-course"
}
],
"payments": [
{
"id": 1231,
"status": 2,
"status_title": "Paid",
"payment_type": null,
"payment_type_title": null,
"payment_form": null,
"payment_form_title": null,
"price_info": {
"amount": 0,
"currency": {
"id": 147,
"code": "UAH",
"html_code": "₴",
"html_letter_code": "грн"
}
},
"paid_at": "2023-10-13T18:04:02.000000Z",
"created_at": "2023-10-13T18:04:02.000000Z",
"updated_at": "2023-10-13T18:04:02.000000Z",
"transactions": [
{
"id": 28,
"merchant_id": 2,
"payment_id": 1231,
"order_id": 1060,
"payment_system_status": "Declined",
"failure_reason": "Cardholder session expired",
"price": "147",
"currency_code": "UAH",
"payer_account": null,
"card_mask": null,
"rrn": null,
"fee": null,
"created_at": "2023-11-03T08:45:10.000000Z"
},
{
"id": 29,
"merchant_id": 2,
"payment_id": 1231,
"order_id": 1060,
"payment_system_status": "Approved",
"failure_reason": null,
"price": "147",
"currency_code": "UAH",
"payer_account": "JKNNASWTZ99SJ",
"card_mask": "53****2144",
"rrn": 330710335365,
"fee": null,
"created_at": "2023-11-03T08:48:10.000000Z"
}
]
}
],
"paid_status": "paid",
"paid_status_title": "Сплачено",
"order_stage": {
"id": 43,
"title": "Стейдж 1",
"order_group": {
"id": 22,
"slug": "voronka-1",
"title": null,
"order": 4,
"created_at": "2023-06-22T18:20:53.000000Z"
},
"order_funnel": {
"id": 1,
"title": "Воронка за замовчуванням",
"created_at": "2023-05-26T09:47:16.000000Z"
},
"created_at": "2023-06-22T18:21:10.000000Z"
},
"cost_info": {
"amount": 0,
"currency": {
"id": 147,
"code": "UAH",
"html_code": "₴",
"html_letter_code": "грн"
}
},
"managers": [
{
"id": 264,
"name": "test",
"email": "testfsdf@fdafasd.fsd"
},
{
"id": 288,
"name": "fdsf",
"email": "sdfs@fdf.dfss"
}
]
}
]
}
}
HTTP Request
POST https://api.kwiga.com/contacts/purchases
Request
Parameter | Description |
---|---|
email (string) (required) |
Email - должен быть уникальным в рамках кабинета |
phone (string) |
Номер телефона - формат: +{код страны}{телефон} Пример: +380930123456 |
first_name (string) |
Имя |
last_name (string) |
Фамилия |
tags (string[]) |
Теги |
send_activation_email (boolean) |
Отправить приветственное письмо |
send_product_access_email (boolean) |
Отправить письмо о доступе к продукту |
locale (string) |
Язык контакта в формате iso_2 Допустимые варианты: en (по умолчанию), uk , ru |
offer_id (integer) |
Идентификатор предложения (можно получить в конце ссылки страницы редактирования предложения) Пример: 3858 с https://sample-school.kwiga.com/expert/payments/offers/edit/3858 Если не передавать Предложение, то будет создан пустой заказ |
order_stage_id (boolean) |
Идентификатор статуса заказа в воронке (можно получить на странице CRM->Заказы->Настройки->Список статусов) |
is_paid (integer) |
Заказ оплачен (по умолчанию true) |
manager_ids (integer[]) |
Менеджеры заказа (можно получить на странице Настройки->Доступи по управлению) |
additional_fields (array) |
Пользовательские (кастомные) поля |
additional_fields[][field_id] (integer) |
id пользовательского поля (можно получить в CRM->Контакты->Настройки->Добавление пользовательских полей) |
additional_fields[][value] (null,string,integer) |
Значение пользовательского поля |
Обновление контакта
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$id = 23698;
$data = [
'first_name' => 'John',
'last_name' => 'Black',
'email' => 'bond123@example.com',
'phone' => '+380931112233',
'tags' => ['test-tag'],
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/' . $id);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request PUT 'https://api.kwiga.com/contacts/23698' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"first_name": "John",
"last_name": "Black",
"email": "bond123@example.com",
"phone": "+380931112233",
"tags": ["test-tag"]
}'
Пример ответа:
{
"data": {
"id": 23698,
"email": "bond123@example.com",
"first_name": "John",
"last_name": "Black",
"phone": "+380931112233",
"tags": [
{
"id": 93,
"name": "test-tag"
}
],
"created_at": "2023-10-05T11:29:24.000000Z",
"last_activity_at": "2023-10-05T12:27:42.000000Z",
"first_visit": {
"id": 4324,
"ip": "172.18.0.1",
"landing_url": "http://cabinet-1.kwiga.local/courses/a1",
"landing_domain": "cabinet-1.kwiga.local",
"landing_path": "courses/a1",
"landing_params": "",
"referrer_domain": null,
"referrer_url": "",
"utm_source": null,
"utm_campaign": null,
"utm_medium": null,
"utm_term": null,
"utm_content": null,
"created_at": "2023-10-06T11:49:07.000000Z"
},
"utm_visits": [],
"offers": [],
"orders": [],
"additional_fields": []
}
}
HTTP Request
PUT https://api.kwiga.com/contacts/{id}
Request
Parameter | Description |
---|---|
email (string) |
Email - должен быть уникальным в рамках кабинета |
phone (string) |
Номер телефона - формат: +{код страны}{телефон} Пример: +380930123456 |
first_name (string) |
Имя |
last_name (string) |
Фамилия |
tags (string[]) |
Теги. Работают в режиме sync. То есть на контакте будут только те теги, которые будут переданы |
additional_fields (array) |
Пользовательские (кастомные) поля |
additional_fields[][field_id] (integer) |
id пользовательского поля (можно получить в CRM->Контакты->Настройки->Добавление пользовательских полей) |
additional_fields[][value] (null,string,integer) |
Значение пользовательского поля |
Добавление тегов контактам
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$data = [
'contacts' => [23698],
'tags' => ['test-tag'],
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/tags');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request POST 'https://api.kwiga.com/contacts/tags' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"contacts": [23698],
"tags": ["test-tag"]
}'
Пример ответа:
{
"success": true
}
HTTP Request
POST https://api.kwiga.com/contacts/tags
Request
Parameter | Description |
---|---|
contacts (integer[]) |
Массив id контактов |
tags (string[]) |
Теги |
Удаление тегов контактов
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$data = [
'contacts' => [23698],
'tags' => ['test-tag'],
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/tags');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request DELETE 'https://api.kwiga.com/contacts/tags' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"contacts": [23698],
"tags": ["test-tag"]
}'
Пример ответа:
{
"success": true
}
HTTP Request
DELETE https://api.kwiga.com/contacts/tags
Request
Parameter | Description |
---|---|
contacts (integer[]) |
Массив id контактов |
tags (string[]) |
Теги |
Предложения
Получение списка предложений
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/offers?product_id=130');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/offers?product_id=130' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": [
{
"id": 273,
"unique_offer_code": "nELQzbLRPmzo",
"url": "https://kwiga.com/o/nELQzbLRPmzo",
"title": "This is paid offer for my course",
"description": "<p style=\"text-align: left\">Description with html.</p>",
"short_description": "<p style=\"text-align: left\">Shot description with html.</p>",
"price_type": {
"id": 2,
"name": "Платно"
},
"price": {
"amount": "10.00",
"amount_rounded": "10.00",
"amount_formatted": "10.00 usd",
"amount_formatted_code": "$10.00",
"amount_formatted_code_short": "$10.00",
"currency": {
"id": 5,
"code": "USD",
"html_code": "$",
"html_letter_code": "usd",
"is_volatile": false
}
},
"price_discounted": {
"amount": 5,
"amount_rounded": "5.00",
"amount_formatted": "5.00 usd",
"amount_formatted_code": "$5.00",
"amount_formatted_code_short": "$5.00",
"currency": {
"id": 5,
"code": "USD",
"html_code": "$",
"html_letter_code": "usd",
"is_volatile": false
}
},
"discount": {
"id": 3,
"price_discounted": 5,
"limit_type": {
"id": 1,
"name": "Безстроково"
},
"start_at": "2023-12-28T14:41:00.000000Z",
"start_at_utc": "2023-12-28T12:41:00.000000Z",
"start_timezone_id": 371,
"end_at": "2024-01-03T14:41:00.000000Z",
"end_type": 3,
"end_at_utc": "2024-01-03T12:41:00.000000Z",
"end_timezone_id": 371,
"sales_limit": null,
"sales": null,
"is_active": true,
"is_available": true,
"created_at": "2023-12-28T12:41:58.000000Z",
"updated_at": "2023-12-28T12:41:58.000000Z",
"start_timezone": {
"id": 371,
"name": "Europe/Kyiv",
"name_full": "Europe/Kyiv (UTC+03:00)",
"value": "UTC+03:00"
},
"end_timezone": {
"id": 371,
"name": "Europe/Kyiv",
"name_full": "Europe/Kyiv (UTC+03:00)",
"value": "UTC+03:00"
}
},
"has_subscription": false,
"limit_type": {
"id": 1,
"name": "Необмежено"
},
"limit_of_sales": null,
"is_active": true,
"is_draft": false,
"validity_start": {
"type": "validity_start",
"duration_type_id": 1,
"date_at": "2023-12-28T14:40:00.000000Z",
"date_at_utc": "2023-12-28T12:40:00.000000Z",
"timezone_id": 371,
"timezone": {
"id": 371,
"name": "Europe/Kyiv",
"name_full": "Europe/Kyiv (UTC+03:00)",
"value": "UTC+03:00"
},
"after_months": 0,
"after_days": 0,
"specific_time": null
},
"validity_end": {
"type": "validity_end",
"duration_type_id": 3,
"date_at": "2023-12-28T14:40:00.000000Z",
"date_at_utc": "2023-12-28T12:40:00.000000Z",
"timezone_id": 371,
"timezone": {
"id": 371,
"name": "Europe/Kyiv",
"name_full": "Europe/Kyiv (UTC+03:00)",
"value": "UTC+03:00"
},
"after_months": 0,
"after_days": 0,
"specific_time": null
},
"products": [
{
"id": 130,
"productable_id": 38,
"productable_type": "course",
"title": "This is my course",
"link": "https://kwiga.com/courses/test-fail"
}
]
},
{
"id": 272,
"unique_offer_code": "2obtMsUEujcy",
"url": "https://kwiga.com/o/2obtMsUEujcy",
"title": "This is free offer for my course",
"description": null,
"short_description": null,
"price_type": {
"id": 1,
"name": "Безкоштовно"
},
"price": {
"amount": "0.00",
"amount_rounded": "0.00",
"amount_formatted": "0.00 usd",
"amount_formatted_code": "$0.00",
"amount_formatted_code_short": "$0.00",
"currency": {
"id": 5,
"code": "USD",
"html_code": "$",
"html_letter_code": "usd",
"is_volatile": false
}
},
"price_discounted": {
"amount": 0,
"amount_rounded": "0.00",
"amount_formatted": "0.00 usd",
"amount_formatted_code": "$0.00",
"amount_formatted_code_short": "$0.00",
"currency": {
"id": 5,
"code": "USD",
"html_code": "$",
"html_letter_code": "usd",
"is_volatile": false
}
},
"discount": null,
"has_subscription": false,
"limit_type": {
"id": 1,
"name": "Необмежено"
},
"limit_of_sales": null,
"is_active": true,
"is_draft": false,
"validity_start": {
"type": "validity_start",
"duration_type_id": 1,
"date_at": "2023-12-27T12:45:00.000000Z",
"date_at_utc": "2023-12-27T10:45:00.000000Z",
"timezone_id": 371,
"timezone": {
"id": 371,
"name": "Europe/Kyiv",
"name_full": "Europe/Kyiv (UTC+03:00)",
"value": "UTC+03:00"
},
"after_months": 0,
"after_days": 0,
"specific_time": null
},
"validity_end": {
"type": "validity_end",
"duration_type_id": 3,
"date_at": "2023-12-27T12:45:00.000000Z",
"date_at_utc": "2023-12-27T10:45:00.000000Z",
"timezone_id": 371,
"timezone": {
"id": 371,
"name": "Europe/Kyiv",
"name_full": "Europe/Kyiv (UTC+03:00)",
"value": "UTC+03:00"
},
"after_months": 0,
"after_days": 0,
"specific_time": null
},
"products": [
{
"id": 130,
"productable_id": 38,
"productable_type": "course",
"title": "This is my course",
"link": "https://kwiga.com/courses/test-fail"
}
]
}
]
}
HTTP Request
GET https://api.kwiga.com/offers
Request
Parameter | Description |
---|---|
product_id (int) (optional) |
Фильтр по продукту |
Получение предложения
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$id = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/offers/' . $id);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/offers/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": {
"id": 1,
"unique_offer_code": "6rT1wj99lbZV",
"title": "Offer #1",
"limit_type": {
"id": 2,
"name": "Certain amount"
},
"limit_of_sales": 20,
"purchases_count": 1,
"sales_left": 19
}
}
HTTP Request
GET https://api.kwiga.com/offers/{id}
Маркетинг. Рассылка
Список групп контактов
Пример запроса:
<?php
// Запрос без параметров
$ch = curl_init();
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/mailing/contact-lists');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
<?php
// Запрос с пагинацией
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/mailing/contact-lists?page=1&limit=50');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/mailing/contact-lists' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
curl --location --request GET 'https://api.kwiga.com/mailing/contact-lists?page=1&limit=50' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": [
{
"id": 2,
"title": "Пример 2",
"description": "Описание",
"is_default": false,
"created_at": "2022-04-28T13:22:44.000000Z",
"updated_at": "2022-04-28T13:22:44.000000Z"
},
{
"id": 1,
"title": "Мой первый список",
"description": "Данный список создаётся автоматически с вашим контактом внутри. Вы можете его отредактировать под свои потребности.",
"is_default": true,
"created_at": "2022-04-28T12:47:08.000000Z",
"updated_at": "2022-04-28T12:47:08.000000Z"
}
],
"links": {
"first": "https://api.kwiga.com/mailing/contact-lists?page=1",
"last": "https://api.kwiga.com/mailing/contact-lists?page=2",
"prev": null,
"next": "https://api.kwiga.com/mailing/contact-lists?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 2,
"links": [
{
"url": null,
"label": "« Предыдущая",
"active": false
},
{
"url": "https://api.kwiga.com/mailing/contact-lists?page=1",
"label": "1",
"active": true
},
{
"url": "https://api.kwiga.com/mailing/contact-lists?page=2",
"label": "2",
"active": false
},
{
"url": "https://api.kwiga.com/mailing/contact-lists?page=2",
"label": "Следующая »",
"active": false
}
],
"path": "https://api.kwiga.com/mailing/contact-lists",
"per_page": 2,
"to": 2,
"total": 3
}
}
HTTP Request
GET https://api.kwiga.com/mailing/contact-lists
URL Parameters
Parameter | Description |
---|---|
page (integer) |
Номер страницы |
limit (integer) |
Кол-во элементов выборки |
Получение группы контактов
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$id = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/mailing/contact-lists/' . $id);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/mailing/contact-lists/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": {
"id": 1,
"title": "Мой первый список",
"description": "Данный список создаётся автоматически с вашим контактом внутри. Вы можете его отредактировать под свои потребности.",
"is_default": true,
"created_at": "2022-04-28T12:47:08.000000Z",
"updated_at": "2022-04-28T12:47:08.000000Z",
"contacts": [
{
"id": 1,
"first_name": "Alex",
"middle_name": null,
"last_name": "Иванович Burt",
"name": "Иванович Burt Alex",
"sex": null,
"age": null,
"email": "admin@grandstep.com.ua",
"phone_country": "UA",
"phone_number": "983721222",
"city": null,
"phone": "+380983721222",
"created_at": "2022-04-28T12:47:07.000000Z",
"updated_at": "2022-04-28T12:47:08.000000Z"
}
],
"statistic": {
"contact_list_id": 1,
"count_contacts": 1
}
}
}
HTTP Request
GET https://api.kwiga.com/mailing/contact-lists/{id}
Создание группы контактов
Пример запроса:
$headers = [
'Accept: application/json',
'Content-Type: application/x-www-form-urlencoded',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$data = [
'title' => 'Название группы',
'description' => 'описание'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/mailing/contact-lists/');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$result = json_decode($response);
curl --location --request POST 'https://api.kwiga.com/mailing/contact-lists' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"title": "Title",
"description": "Description"
}'
Пример ответа:
{
"data": {
"id": 3,
"title": "fsdaf asfsf dsafsda fsda",
"description": "1dsad sadsa ds dsa",
"is_default": false,
"created_at": "2022-05-04T09:57:37.000000Z",
"updated_at": "2022-05-04T09:57:37.000000Z"
}
}
HTTP Request
POST https://api.kwiga.com/mailing/contact-lists
Request
Parameter | Description |
---|---|
title (string) (required) |
Название |
description (string) |
Описание |
Добавление контактов в группу
Пример запроса:
$headers = [
'Accept: application/json',
'Content-Type: application/x-www-form-urlencoded',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$data = [
'contacts' => [
1,
2
],
'contact_lists' => [
1
]
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/mailing/contact-lists/bulk-contacts');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$result = json_decode($response);
curl --location --request POST 'https://api.kwiga.com/mailing/contact-lists/bulk-contacts' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"contacts": [
1,
2
],
"contact_lists": [
2
]
}'
Пример ответа:
{
"success": true
}
HTTP Request
POST https://api.kwiga.com/mailing/contact-lists/bulk-contacts
URL Parameters
Parameter | Description |
---|---|
contacts (array) (required) |
Контакты (ID) |
contact_lists (array) (required) |
Группы контактов (ID) |
Продажи. Купоны
Список купонов
Пример запроса:
<?php
// Запрос без параметров
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/coupons');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
<?php
// Запрос с фильтрацией
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/coupons?filters[date_from]=2022-04-15&filters[date_to]=2022-04-27');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/coupons' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
curl --location --request GET 'https://api.kwiga.com/coupons?filters[date_from]=2022-04-15&filters[date_to]=2022-04-27' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": [
{
"id": 3,
"code": "KwigaSMVT-MD",
"reward": 30,
"is_fixed": true,
"is_disposable": false,
"used_amount": 0,
"total_uses": 10,
"total_uses_per_user": 1,
"user": {
"id": 3,
"avatar_url": "https://someurl.com",
"hash": "EL9p2ycy4Ypga715",
"name": "Test User",
"email": "test@example.com",
"tag_name": "TestUser"
},
"created_at": "2022-04-28T09:46:11.000000Z",
"updated_at": "2022-04-28T09:46:11.000000Z",
"deleted_at": null
}
]
}
GET https://api.kwiga.com/coupons
URL Parameters
Parameter | Description |
---|---|
filters[date_from] (2022-04-15) |
Фильтр по дате создания. Параметр 'от' |
filters[date_to] (2022-04-27) |
Фильтр по дате создания. Параметр 'до' |
Получение купона
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$id = 1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/coupons/' . $id);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/coupons/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": {
"id": 1,
"code": "KwigaSMVT-MD",
"reward": 30,
"is_fixed": true,
"is_disposable": false,
"used_amount": 0,
"total_uses": 10,
"total_uses_per_user": 1,
"created_at": "2022-04-28T09:46:11.000000Z",
"updated_at": "2022-04-28T09:46:11.000000Z",
"deleted_at": null
}
}
HTTP Request
GET https://api.kwiga.com/coupons/{id}
Создать купон
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$data = [
'code' => 'MY-COUPON',
'reward' => 0,
'type_discount' => ['id' => 'discount_with_percent'],
'expires_at' => null,
'timezone' => ['id' => 375],
'total_uses' => 0,
'total_uses_per_user' => 0,
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/coupons');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request POST 'https://api.kwiga.com/coupons' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{
"code": "MY-COUPON",
"reward": 100,
"type_discount": {
"id": "discount_with_percent"
},
"expires_at": null,
"timezone": {
"id": 375
},
"total_uses": 0,
"total_uses_per_user": 1
}'
Пример ответа:
{
"data": {
"id": 8,
"code": "MY-COUPON",
"reward": 100,
"type_discount": {
"id": "discount_with_percent",
"name": "In % of order/offer value"
},
"type_date_expired": {
"id": "indefinite_action",
"name": "Never expires"
},
"type_total_count_used": {
"id": "certain_amount",
"name": "A certain amount"
},
"type_used_contact_lists": {
"id": "all_users",
"name": "All users"
},
"is_fixed": false,
"is_active": true,
"used_amount": 0,
"has_infinite_used": true,
"has_access_contact_lists": false,
"total_uses": 0,
"total_uses_per_user": 1,
"contact_lists": [],
"type": {
"id": 4,
"title": "Offers"
},
"expires_at": null,
"expires_at_utc": null,
"timezone_id": null,
"currency_id": null,
"currency": null,
"created_at": "2024-01-09T16:17:55.000000Z",
"updated_at": "2024-01-09T16:17:55.000000Z",
"deleted_at": null
}
}
HTTP Request
POST https://api.kwiga.com/coupons
URL Parameters
Parameter | Description |
---|---|
code (string length:3-32) |
Код купона. Если не указать, то код сгенерируется автоматически |
type_discount.id (string) (required) |
Тип скидки: процент от суммы - discount_with_percent или фиксированная скидка - discount_with_currency |
expires_at (null|date|datetime) |
Срок действия купона. Если null или не указывать, то бессрочно |
timezone.id (null|integer) |
Таймзона даты срока действия купона |
total_uses (integer) |
Лимит на количество использований купона. 0 - без ограничений |
total_uses_per_user (integer) |
Лимит на количество использований купона одним пользователем |
Сертификаты
Получение сертификат по номеру
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$certificateNumber = '1986-0001';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/certificates/by-number/' . $certificateNumber);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/certificates/by-number/1986-0001' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": {
"id": 55,
"uuid": "262e7042-1933-42a9-ba01-e96d7d5110dc",
"cabinet_id": 1,
"user_id": 273,
"issued_at": "2023-07-25T15:36:44.000000Z",
"number": "1986-0001",
"link": "http://cabinet-1.kwiga.local/certificates/262e7042-1933-42a9-ba01-e96d7d5110dc",
"created_at": "2023-07-25T15:36:44.000000Z",
"updated_at": "2023-07-25T15:36:44.000000Z",
"finished_at": "2023-07-25T15:36:44.000000Z",
"points": 120,
"user": {
"id": 273,
"name": "test name",
"email": "test-student@kwiga.com"
},
"certificateble_title": "Test course"
}
}
HTTP Request
GET https://api.kwiga.com/certificates/by-number/{number}
Таймзоны
Получения списка таймзон
Пример запроса:
<?php
$headers = [
'Accept: application/json',
'Token: <Token>',
'Cabinet-Hash: <Cabinet-Hash>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/timezones');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response);
?>
curl --location --request GET 'https://api.kwiga.com/timezones' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
Пример ответа:
{
"data": [
{
"id": 1,
"name": "Asia/Kabul",
"name_full": "Asia/Kabul (UTC+04:30)",
"value": "UTC+04:30"
},
{
"id": 2,
"name": "Europe/Tirane",
"name_full": "Europe/Tirane (UTC+02:00)",
"value": "UTC+02:00"
},
...
]
}
GET https://api.kwiga.com/timezones