PHP cURL

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 --location --request GET 'https://api.kwiga.com/contacts/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'

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:

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:

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
it Italian
es Spanish
de German
pl Polish

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 --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>'

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": "&laquo; 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 &raquo;",
                "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 --location --request GET 'https://api.kwiga.com/contacts/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'

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' => [
        [
            '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"
    }
  ]
}'

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

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' => [
        [
            '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"
    }
  ]
}'

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

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
(boolean)
Identifier of order stage in funnel (can be obtained in CRM->Orders->Settings->Status list)
is_paid
(integer)
Order is paid (default true)
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

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

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

Parameter Description
contacts
(integer[])
Contacts ids array
tags
(string[])
Tags

Offers

Get offers

Request example:

<?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>'

Example of response:

{
    "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)
Filter by product

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 --location --request GET 'https://api.kwiga.com/offers/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'

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 --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>'

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": "&laquo; 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 &raquo;",
                "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 --location --request GET 'https://api.kwiga.com/mailing/contact-lists/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'

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 --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"
}'

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

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 --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
  ]
}'

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 --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>'

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 --location --request GET 'https://api.kwiga.com/coupons/1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'

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}

Create coupon

Request example:

<?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
}'

Example of response:

{
    "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)
Coupon code. If you do not specify, the code is generated automatically
type_discount.id
(string)
(required)
Discount type: percentage of the amount - discount_with_percent or fixed discount - discount_with_currency
expires_at
(null|date|datetime)
Coupon validity period. If null or not specified, then indefinitely
timezone.id
(null|integer)
Time zone of coupon expiration date
total_uses
(integer)
Limit on the number of times a coupon can be used. 0 - unlimited
total_uses_per_user
(integer)
Limit on the number of times a coupon can be used by one user

Certificates

Receiving a certificate by number

Request example:

<?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>'

Example of response:

{
    "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}

Timezones

Getting a list of time zones

Request example:

<?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>'

Example of response:

{
    "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