Introduction
This is KWIGA API documentation page. You have the ability to perform certain actions on your behalf in certain cabinets using your API.
In order to enable the API you should click on the corresponding checkbox in the settings section of your account. After that a token will be generated and account hash will be created, that will be used for subsequent API calls.
If a token is compromised, it can be re-issued, that will make the old token inactive and generate a new one.
API is only available for those users who have API enabled in their account.
API has a limit on hits per second. Currently 1 hit per second is available.
Basic work with 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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/contacts/1
All requests must be directed to the domain:
https://api.kwiga.com
For authorization the API token should be send in one of the next variants:
in headers:
Token: {token}
in GET/POST parameters:
token={token}
To identify the account in which the actions take place, the hash of the account must be sent along in one of the next variants:
in headers:
Cabinet-Hash: {cabinet_hash}
in GET/POST parameters:
cabinet_hash={cabinet_hash}
You can set the localization of directories and validation messages with the header:
X-Language: {locale}
Locale | Description |
---|---|
en | English (default) |
uk | Ukrainian |
ru | Russian |
Errors
Error Code | Meaning |
---|---|
400 | Bad Request - Your request is invalid. |
401 | Unauthorized - Your API key is wrong. |
403 | Forbidden - The requested resource is hidden for administrators only. |
404 | Not Found - Server cannot find the requested resource. |
405 | Method Not Allowed -- Server knows the request method, but the target resource doesn't support this method. |
406 | Not Acceptable - You requested a format that isn't json. |
410 | Gone - The requested resource has been removed from our servers. |
422 | Unprocessable entity. |
429 | Too Many Requests - You're sending too many requests! Slow down! |
500 | Internal Server Error - We had a problem with our server. Try again later. |
503 | Service Unavailable - We're temporarily offline for maintenance. Please try again later. |
CRM. Contacts
List of contacts
Request example:
<?php
// Request without parameters
$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
// Request with pagination
$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
// Request with pagination and filtering
$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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/contacts
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/contacts?page=1&per_page=15
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/contacts?page=1&per_page=15&filters[date_from]=2022-04-27&filters[search]=example.com&with_offers=1
Example of response:
{
"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": "« Prev",
"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": "Next »",
"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) |
Page Number |
per_page (integer) |
Number of fetch items |
filters[is_active] (integer) |
Filter by Active Contacts |
filters[date_from] (2023-08-30/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Filter by creation date. Parameter 'from' |
filters[date_to] (2023-08-31/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Filter by creation date. 'To' parameter |
filters[last_activity_from] (2023-08-30/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Filter by last activity date. Parameter 'from' |
filters[last_activity_to] (2023-08-31/2023-08-30 00:00:00/2023-08-30T00:00:00) UTC |
Filter by last activity date. 'To' parameter |
filters[search] (string) |
Filter by email, phone, name |
with_offers (boolean) |
Get additional information on contact offers |
with_orders (boolean) |
Get additional information on contact orders |
Get contact
Request example:
<?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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/contacts/1
Example of response:
{
"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}
Create contact
Request example:
$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' => [
[
'filed_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 -X POST -H 'Accept: application/json' -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -H 'Content-Type: application/json' -d '{"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"}]}' https://api.kwiga.com/contacts
Example of response:
{
"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 (application/x-www-form-urlencoded)
Parameter | Description |
---|---|
email (string) (required) |
Email - should be unique value within an account |
phone (string) |
Phone number - format: +{country code}{phone} Example: +380930123456 |
first_name (string) |
Name |
last_name (string) |
Last name |
tags (string[]) |
Tags |
send_activation_email (boolean) |
Send a welcome email |
locale (string) |
Contact’s language in iso_2 format Options include: en (by default), uk , ru |
create_order (boolean) |
Create an empty order |
order_stage_id (integer) |
Identifier of order stage in funnel (can be obtained in CRM->Orders->Settings->Status list) |
additional_fields (array) |
Custom fields |
additional_fields[][field_id] (integer) |
Custom field id (can be obtained in в CRM->Contacts->Settings->Add custom fields) |
additional_fields[][value] (null,string,integer) |
Custom field value |
Add purchase
This method creates or finds contact, as well as adds purchase of the specified offer
Request example:
$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' => [
[
'filed_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 -X POST -H 'Accept: application/json' -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -H 'Content-Type: application/json' -d '{"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"}]}' https://api.kwiga.com/contacts/purchases
Example of response:
{
"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 (application/x-www-form-urlencoded)
Parameter | Description |
---|---|
email (string) (required) |
Email - should be unique value within an account |
phone (string) |
Phone number - format: +{country code}{phone} Example: +380930123456 |
first_name (string) |
Name |
last_name (string) |
Last name |
tags (string[]) |
Tags |
send_activation_email (boolean) |
Send a welcome email |
send_product_access_email (boolean) |
Send an email about product access |
locale (string) |
Contact’s language in iso_2 format Options include: en (by default), uk , ru |
offer_id (integer) |
Identifier of the offer (can be obtained at the end of the link on the offer editing page). Example: 3858 from https://sample-school.kwiga.com/expert/payments/offers/edit/3858 If you do not submit the Offer, an empty order will be created |
order_stage_id (integer) |
Identifier of order stage in funnel (can be obtained in CRM->Orders->Settings->Status list) |
manager_ids (integer[]) |
Managers to order (can be obtained in Settings->Administration access) |
additional_fields (array) |
Custom fields |
additional_fields[][field_id] (integer) |
Custom field id (can be obtained in в CRM->Contacts->Settings->Add custom fields) |
additional_fields[][value] (null,string,integer) |
Custom field value |
Contact update
Request example:
<?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"]
}'
Example of response:
{
"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 (application/x-www-form-urlencoded)
Parameter | Description |
---|---|
email (string) |
Email - should be unique value within an account |
phone (string) |
Phone number - format: +{country code}{phone} Example: +380930123456 |
first_name (string) |
Name |
last_name (string) |
Last name |
tags (string[]) |
Tags. They work in sync mode. That is, the contact will only have those tags that will be transferred |
additional_fields (array) |
Custom fields |
additional_fields[][field_id] (integer) |
Custom field id (can be obtained in в CRM->Contacts->Settings->Add custom fields) |
additional_fields[][value] (null,string,integer) |
Custom field value |
Contact tags adding
Request example:
<?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"]
}'
Example of response:
{
"success": true
}
HTTP Request
POST https://api.kwiga.com/contacts/tags
Request (application/x-www-form-urlencoded)
Parameter | Description |
---|---|
contacts (integer[]) |
Contacts ids array |
tags (string[]) |
Tags |
Contact tags removing
Request example:
<?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"]
}'
Example of response:
{
"success": true
}
HTTP Request
DELETE https://api.kwiga.com/contacts/tags
Request (application/x-www-form-urlencoded)
Parameter | Description |
---|---|
contacts (integer[]) |
Contacts ids array |
tags (string[]) |
Tags |
Offers
Get offer
Request example:
<?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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/offers/1
Example of response:
{
"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}
Marketing. Mailing
Contact Group List
Request example:
<?php
// Request without parameters
$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
// Request with pagination
$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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/mailing/contact-lists
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/mailing/contact-lists?page=1&limit=50
Example of response:
{
"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": "« Prev",
"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": "Next »",
"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) |
Page Number |
limit (integer) |
Number of fetch items |
Getting a group of contacts
Request example:
<?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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/mailing/contact-lists/1
Example of response:
{
"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}
Creating a contact group
Request example:
$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 -X POST -H 'Accept: application/json' -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -H 'Content-Type: application/json' -d '{"title" : "Название группы", "description" : "описание"}' https://api.kwiga.com/mailing/contact-lists
Example of response:
{
"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 (application/x-www-form-urlencoded)
Parameter | Description |
---|---|
title (string) (required) |
Title |
description (string) |
Description |
Adding Contacts to a Bulk
Request example:
$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 -X POST -H 'Accept: application/json' -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -H 'Content-Type: application/json' -d '{"contacts" : [1, 2], "contact_lists" : [2]}' https://api.kwiga.com/mailing/contact-lists/bulk-contacts
Example of response:
{
"success": true
}
HTTP Request
POST https://api.kwiga.com/mailing/contact-lists/bulk-contacts
URL Parameters
Parameter | Description |
---|---|
contacts (array) (required) |
Contacts (ID) |
contact_lists (array) (required) |
Contact Groups (ID) |
Payments. Coupons
Coupon list
Request example:
<?php
// Request without parameters
$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
// Query with filtering
$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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/coupons
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/coupons?filters[date_from]=2022-04-15&filters[date_to]=2022-04-27
Example of response:
{
"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) |
Filter by creation date. Parameter 'from' |
filters[date_to] (2022-04-27) |
Filter by creation date. 'To' parameter |
Getting a coupon
Request example:
<?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 -i -H "Accept: application/json" -H "Content-Type: application/json" -H 'Token: <Token>' -H 'Cabinet-Hash: <Cabinet-Hash>' -X GET https://api.kwiga.com/coupons/1
Example of response:
{
"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}