PHP (Guzzle) PHP (cURL) cURL JavaScript Python

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.

The API has a rate limit of 200 requests per minute.

Basic work with API

<?php
// Get contact by ID

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/contacts/{id}', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get contact by ID

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$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/{id}' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get contact by ID
const url = 'https://api.kwiga.com/contacts/{id}';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get contact by ID
import requests

url = 'https://api.kwiga.com/contacts/{id}'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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:

PUT and DELETE requests can be sent as POST requests by specifying an additional _method parameter with the required method (PUT or DELETE).

You can set the localization of directories and validation messages with the header:

X-Language: {locale}

Locale Description
en English (default)
cs Czech
de German
el Greek
es Spanish
fr Franch
it Italian
ka Georgian
lv Polish
pl Polish
pt Portuguese
ro Romanian
ru Russian
uk Ukrainian
zh Chinese (Simplified)

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.
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
// Get contacts list

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/contacts', $options);

$result = json_decode($response->getBody());
?>


# ---
# Paginated example
# ---

<?php
// Get contacts list with pagination

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/contacts?page=1&per_page=15', $options);

$result = json_decode($response->getBody());
?>


# ---
# Filtered example
# ---

<?php
// Get contacts list with filters

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/contacts?page=1&per_page=15&filters[date_from]=2022-04-27&filters[search]=example.com&with_offers=1', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get contacts list

$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);
?>


# ---
# Paginated example
# ---

<?php
// Get contacts list 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);
?>


# ---
# Filtered example
# ---

<?php
// Get contacts list with filters

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


# ---
# Paginated example
# ---

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


# ---
# Filtered example
# ---

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>'
// Get contacts list
const url = 'https://api.kwiga.com/contacts';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });


# ---
# Paginated example
# ---

// Get contacts list with pagination
const url = 'https://api.kwiga.com/contacts?page=1&per_page=15';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });


# ---
# Filtered example
# ---

// Get contacts list with filters
const url = 'https://api.kwiga.com/contacts?page=1&per_page=15&filters[date_from]=2022-04-27&filters[search]=example.com&with_offers=1';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get contacts list
import requests

url = 'https://api.kwiga.com/contacts'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()


# ---
# Paginated example
# ---

# Get contacts list with pagination
import requests

url = 'https://api.kwiga.com/contacts?page=1&per_page=15'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()


# ---
# Filtered example
# ---

# Get contacts list with filters
import requests

url = 'https://api.kwiga.com/contacts?page=1&per_page=15&filters[date_from]=2022-04-27&filters[search]=example.com&with_offers=1'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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
          }
      ]
    },
    "utm": {
        "utm_source": [
            "test-source"
        ],
        "utm_campaign": [],
        "utm_medium": [],
        "utm_term": [
            "test-term"
        ],
        "utm_content": []
    },
    {
      "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; translation missing: en.pagination_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": "translation missing: en.pagination_next &raquo;",
                "active": false
            }
        ],
        "path": "https://api.kwiga.com/contacts",
        "per_page": 15,
        "to": 2,
        "total": 3
    }
}

GET https://api.kwiga.com/contacts

URL Parameters

filters object optional
Filter parameters
is_active integer optional
Filter by Active Contacts
date_from datetime optional
Filter by creation date. Parameter 'from'
date_to datetime optional
Filter by creation date. 'To' parameter
last_activity_from datetime optional
Filter by last activity date. Parameter 'from'
last_activity_to datetime optional
Filter by last activity date. 'To' parameter
search string optional
Filter by email, phone, name
utm_source string optional
utm_source
utm_campaign string optional
utm_campaign
utm_medium string optional
utm_medium
utm_term string optional
utm_term
utm_content string optional
utm_content
offers integer[] optional
offers ids
products integer[] optional
products ids

with_orders boolean optional
Additionally get information on contact orders and offers
with_certificates boolean optional
Get additional information on contact certificates
page integer optional
Page Number
Default: 1
per_page integer optional
Number of fetch items
Default: 15
sort_by string optional
Possible values: asc, desc

Get contact

Request example:

<?php
// Get contact by ID

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/contacts/{id}', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get contact by ID

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$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/{id}' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get contact by ID
const url = 'https://api.kwiga.com/contacts/{id}';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get contact by ID
import requests

url = 'https://api.kwiga.com/contacts/{id}'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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

GET https://api.kwiga.com/contacts/:contact

URL Parameters

with_certificates boolean optional
Get additional information on contact certificates

Create contact

Request example:

<?php
// Create new contact

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        '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"}],
    ],
];

$response = $client->request('POST', '/contacts', $options);

$result = json_decode($response->getBody());
?>
<?php
// Create new contact

$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);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$data = [
    '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"}],
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($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"}]}'
// Create new contact
const url = 'https://api.kwiga.com/contacts';

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    '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"}]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Create new contact
import requests

url = 'https://api.kwiga.com/contacts'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    '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"}],
}

response = requests.post(url, headers=headers, json=data)

result = response.json()

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

POST https://api.kwiga.com/contacts

Request

email string required
Email - should be unique value within an account
phone string optional
Phone number - format: +{country code}{phone}
Example: +380930123456
first_name string optional
Name
last_name string optional
Last name
tags string[] optional
Tags
send_activation_email boolean optional
Send a welcome email
locale string optional
Contact's language in iso_2 format
Options include: `en` (by default), `cs`, `de`, `el`, `es`, `fr`, `it`, `ka`, `lv`, `pl`, `pt`, `ro`, `ru`, `uk`, `zh`
create_order boolean optional
Create an empty order
order_stage_id integer optional
Identifier of order stage in funnel (can be obtained in *CRM->Orders->Settings->Status list*)
additional_fields object[] optional
Custom fields
field_id integer optional
Custom field id (can be obtained in *CRM->Contacts->Settings->Add custom fields*)
value string optional
Custom field value

Add purchase

This method creates or finds contact, as well as adds purchase of the specified offer

Request example:

<?php
// Add purchase to contact

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        '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"}],
    ],
];

$response = $client->request('POST', '/contacts/purchases', $options);

$result = json_decode($response->getBody());
?>
<?php
// Add purchase to contact

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/purchases');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$data = [
    '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"}],
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($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"}]}'
// Add purchase to contact
const url = 'https://api.kwiga.com/contacts/purchases';

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    '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"}]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Add purchase to contact
import requests

url = 'https://api.kwiga.com/contacts/purchases'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    '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"}],
}

response = requests.post(url, headers=headers, json=data)

result = response.json()

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

POST https://api.kwiga.com/contacts/purchases

Request

email string required
Email - should be unique value within an account
phone string optional
Phone number - format: +{country code}{phone}
Example: +380930123456
first_name string optional
Name
last_name string optional
Last name
tags string[] optional
Tags
send_activation_email boolean optional
Send a welcome email
send_product_access_email boolean optional
Send an email about product access
send_payment_success_email boolean optional
Send an email about successful offer payment
locale string optional
Contact's language in iso_2 format
Options include: `en` (by default), `cs`, `de`, `el`, `es`, `fr`, `it`, `ka`, `lv`, `pl`, `pt`, `ro`, `ru`, `uk`, `zh`
offer_id integer optional
Offer identifier (can be obtained at the end of the offer edit page URL)
Example: 3858 from https://sample-school.kwiga.com/expert/payments/offers/edit/3858
If Offer is not provided, it will check the product_ids field
product_ids integer[] optional
Array of product IDs.
If offer_id and product_ids are missing, an empty order will be created
order_stage_id integer optional
Identifier of order stage in funnel (can be obtained in *CRM->Orders->Settings->Status list*)
is_paid integer optional
Order is paid (default *true*)
manager_ids integer[] optional
Managers to order (can be obtained in *Settings->Administration access*)
comment string optional
Order comment. Max: 5000
Max length: 5000 characters
additional_fields object[] optional
Custom fields
field_id integer optional
Custom field id (can be obtained in *CRM->Contacts->Settings->Add custom fields*)
value string optional
Custom field value

Contact update

Request example:

<?php
// Update contact

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'first_name' => 'John',
        'last_name' => 'Black',
        'email' => 'bond123@example.com',
        'phone' => '+380931112233',
        'tags' => ["test-tag"],
    ],
];

$response = $client->request('PUT', '/contacts/{id}', $options);

$result = json_decode($response->getBody());
?>
<?php
// Update contact

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$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);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');

$data = [
    'first_name' => 'John',
    'last_name' => 'Black',
    'email' => 'bond123@example.com',
    'phone' => '+380931112233',
    'tags' => ["test-tag"],
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

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

$result = json_decode($response);
?>
curl --location --request PUT 'https://api.kwiga.com/contacts/{id}' \
--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"]}'
// Update contact
const url = 'https://api.kwiga.com/contacts/{id}';

const options = {
  method: 'PUT',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'first_name': 'John',
    'last_name': 'Black',
    'email': 'bond123@example.com',
    'phone': '+380931112233',
    'tags': ["test-tag"]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Update contact
import requests

url = 'https://api.kwiga.com/contacts/{id}'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'first_name': 'John',
    'last_name': 'Black',
    'email': 'bond123@example.com',
    'phone': '+380931112233',
    'tags': ["test-tag"],
}

response = requests.put(url, headers=headers, json=data)

result = response.json()

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

PUT https://api.kwiga.com/contacts/:contact

Request

email string optional
Email - should be unique value within an account
phone string optional
Phone number - format: +{country code}{phone}
Example: +380930123456
first_name string optional
Name
last_name string optional
Last name
tags string[] optional
Tags. They work in sync mode. That is, the contact will only have those tags that will be transferred
additional_fields object[] optional
Custom fields
field_id integer optional
Custom field id (can be obtained in *CRM->Contacts->Settings->Add custom fields*)
value string optional
Custom field value

Contact tags adding

Request example:

<?php
// Add tags to contacts

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'contacts' => [23698],
        'tags' => ["test-tag"],
    ],
];

$response = $client->request('POST', '/contacts/tags', $options);

$result = json_decode($response->getBody());
?>
<?php
// Add tags to contacts

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/tags');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$data = [
    'contacts' => [23698],
    'tags' => ["test-tag"],
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$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"]}'
// Add tags to contacts
const url = 'https://api.kwiga.com/contacts/tags';

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'contacts': [23698],
    'tags': ["test-tag"]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Add tags to contacts
import requests

url = 'https://api.kwiga.com/contacts/tags'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'contacts': [23698],
    'tags': ["test-tag"],
}

response = requests.post(url, headers=headers, json=data)

result = response.json()

Example of response:

{
    "success": true
}

POST https://api.kwiga.com/contacts/tags

Request

contacts integer[] required
Contacts ids array
tags string[] required
Tags

Contact tags removing

Request example:

<?php
// Remove tags from contacts

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'contacts' => [23698],
        'tags' => ["test-tag"],
    ],
];

$response = $client->request('DELETE', '/contacts/tags', $options);

$result = json_decode($response->getBody());
?>
<?php
// Remove tags from contacts

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/tags');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');

$data = [
    'contacts' => [23698],
    'tags' => ["test-tag"],
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$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"]}'
// Remove tags from contacts
const url = 'https://api.kwiga.com/contacts/tags';

const options = {
  method: 'DELETE',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'contacts': [23698],
    'tags': ["test-tag"]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Remove tags from contacts
import requests

url = 'https://api.kwiga.com/contacts/tags'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'contacts': [23698],
    'tags': ["test-tag"],
}

response = requests.delete(url, headers=headers, json=data)

result = response.json()

Example of response:

{
    "success": true
}

DELETE https://api.kwiga.com/contacts/tags

Request

contacts integer[] required
Contacts ids array
tags string[] required
Tags

Contact products list

Request example:

<?php
// Get contact products

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/contacts/:contact/products', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get contact products

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/:contact/products');
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/:contact/products' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get contact products
const url = 'https://api.kwiga.com/contacts/:contact/products';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get contact products
import requests

url = 'https://api.kwiga.com/contacts/:contact/products'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

Example of response:

{
  "data": [
    {
      "id": 299,
      "productable_id": 142,
      "productable_type": "course",
      "title": "Copy Test backup",
      "image_url": "",
      "is_published": false,
      "aggregated_subscription": {
        "is_active": true,
        "is_paid": true,
        "start_at": "2025-05-05T15:09:04.000000Z",
        "end_at": null,
        "offer_end_at": null,
        "order_end_at": null,
        "count_available_days": 39,
        "count_left_days": null,
        "state": {
          "id": 2,
          "name": "Open",
          "title": "Open"
        }
      },
      "subscriptions": [
        {
          "id": 4775,
          "creator_id": 24457,
          "user_id": 24457,
          "product_id": 299,
          "order_id": 2710,
          "offer_id": 757,
          "is_active": true,
          "start_at": "2025-05-05T15:09:04.000000Z",
          "order_end_at": null,
          "end_at": null,
          "paid_at": "2025-05-05T15:09:04.000000Z",
          "created_at": "2025-05-05T15:09:04.000000Z",
          "updated_at": "2025-05-05T15:09:04.000000Z"
        }
      ]
    }
  ]
}

GET https://api.kwiga.com/contacts/:contact/products

Returns a list of contact products with subscription and access period information. The aggregated_subscription parameter contains summary information about the terms and activity of access based on all user subscriptions for the product. The subscriptions parameter contains an array of all user subscriptions for the product.

Delete product from contact

Request example:

<?php
// Delete contact product

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('DELETE', '/contacts/:contact/products/:product', $options);

$result = json_decode($response->getBody());
?>
<?php
// Delete contact product

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/:contact/products/:product');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');

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

$result = json_decode($response);
?>
curl --location --request DELETE 'https://api.kwiga.com/contacts/:contact/products/:product' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Delete contact product
const url = 'https://api.kwiga.com/contacts/:contact/products/:product';

const options = {
  method: 'DELETE',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Delete contact product
import requests

url = 'https://api.kwiga.com/contacts/:contact/products/:product'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.delete(url, headers=headers)

result = response.json()

Example of response:

{
  "success": true
}

DELETE https://api.kwiga.com/contacts/:contact/products/:product

Deletes contact subscriptions for the specified product. Orders become custom without access to deleted products.

Delete products from contact (bulk)

Request example:

<?php
// Delete contact products in bulk

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'email' => 'user@example.com',
        'product_id' => 299,
        'offers' => [421],
    ],
];

$response = $client->request('DELETE', '/contacts/products', $options);

$result = json_decode($response->getBody());
?>
<?php
// Delete contact products in bulk

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/contacts/products');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');

$data = [
    'email' => 'user@example.com',
    'product_id' => 299,
    'offers' => [421],
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

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

$result = json_decode($response);
?>
curl --location --request DELETE 'https://api.kwiga.com/contacts/products' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{"email":"user@example.com","product_id":299,"offers":[421]}'
// Delete contact products in bulk
const url = 'https://api.kwiga.com/contacts/products';

const options = {
  method: 'DELETE',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'email': 'user@example.com',
    'product_id': 299,
    'offers': [421]
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Delete contact products in bulk
import requests

url = 'https://api.kwiga.com/contacts/products'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'email': 'user@example.com',
    'product_id': 299,
    'offers': [421],
}

response = requests.delete(url, headers=headers, json=data)

result = response.json()

Example of response:

{
  "data": {
    "affected_subscriptions": [
      2309,
      2661
    ],
    "affected_orders": [
      1578,
      1784
    ],
    "affected_by_offers": {
      "421": {
        "affected_subscriptions": [
          2309,
          2661
        ],
        "affected_orders": [
          1578,
          1784
        ]
      }
    },
    "affected_by_products": []
  },
  "contact_id": 125
}

DELETE https://api.kwiga.com/contacts/products

Deletes subscriptions by specified conditions, and orders become custom without access to deleted products. You can combine product_id and offers parameters to delete part of products by specific offer.

Parameters

email string optional
Contact email. Required if contact_id is not provided
contact_id integer optional
Contact id. Required if email is not provided
product_id integer optional
Product id. Required if offers is not provided. Can be obtained from the Contact Products List endpoint or from the Courses List (it will be the product_id field in the course)
offers integer[] optional
Array of offer ids by which subscriptions are deleted. Required if product_id is not provided. Can be obtained from the offer edit page URL or from the API in the contact offers list.

Products

Cabinet products list

Request example:

<?php
// Get products list

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/products', $options);

$result = json_decode($response->getBody());
?>


# ---
# Paginated example
# ---

<?php
// Get products list with pagination and sorting

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/products?per_page=20&page=1&sort_by=asc', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get products list

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/products');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

$result = json_decode($response);
?>


# ---
# Paginated example
# ---

<?php
// Get products list with pagination and sorting

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/products?per_page=20&page=1&sort_by=asc');
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/products' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'


# ---
# Paginated example
# ---

curl --location --request GET 'https://api.kwiga.com/products?per_page=20&page=1&sort_by=asc' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get products list
const url = 'https://api.kwiga.com/products';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });


# ---
# Paginated example
# ---

// Get products list with pagination and sorting
const url = 'https://api.kwiga.com/products?per_page=20&page=1&sort_by=asc';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get products list
import requests

url = 'https://api.kwiga.com/products'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()


# ---
# Paginated example
# ---

# Get products list with pagination and sorting
import requests

url = 'https://api.kwiga.com/products?per_page=20&page=1&sort_by=asc'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

Example of response:

{
  "data": [
    {
      "id": 299,
      "productable_id": 142,
      "productable_type": "course",
      "title": "Sample Course Title",
      "link": "http://test.local/courses/test-slug"
    }
  ],
  "links": {
    "first": "https://api.kwiga.com/products?page=1",
    "last": "https://api.kwiga.com/products?page=5",
    "prev": null,
    "next": "https://api.kwiga.com/products?page=2"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 5,
    "path": "https://api.kwiga.com/products",
    "per_page": 15,
    "to": 15,
    "total": 75
  }
}

GET https://api.kwiga.com/products

Cabinet products list. Pagination is available, default is 15.

URL Parameters

sort_by string optional
Possible values: asc, desc
per_page integer optional
Number of items per page
Default: 15
page integer optional
Page number
Default: 1

Courses

Cabinet courses list

Request example:

<?php
// Get courses list

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/courses', $options);

$result = json_decode($response->getBody());
?>


# ---
# With_params example
# ---

<?php
// Get courses list with pagination and includes

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/courses?with[]=offers&with[]=description&with[]=program&per_page=15&page=1', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get courses list

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/courses');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

$result = json_decode($response);
?>


# ---
# With_params example
# ---

<?php
// Get courses list with pagination and includes

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/courses?with[]=offers&with[]=description&with[]=program&per_page=15&page=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/courses' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'


# ---
# With_params example
# ---

curl --location --request GET 'https://api.kwiga.com/courses?with[]=offers&with[]=description&with[]=program&per_page=15&page=1' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get courses list
const url = 'https://api.kwiga.com/courses';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });


# ---
# With_params example
# ---

// Get courses list with pagination and includes
const url = 'https://api.kwiga.com/courses?with[]=offers&with[]=description&with[]=program&per_page=15&page=1';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get courses list
import requests

url = 'https://api.kwiga.com/courses'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()


# ---
# With_params example
# ---

# Get courses list with pagination and includes
import requests

url = 'https://api.kwiga.com/courses?with[]=offers&with[]=description&with[]=program&per_page=15&page=1'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

Example of response:

{
  "data": [
    {
      "id": 226,
      "product_id": 431,
      "type": {
        "id": 1,
        "name": "Course",
        "type": "course"
      },
      "title": "Test черновик квизов",
      "slug": "test-chernovik-kvizov",
      "preview": {
        "id": 3140,
        "uuid": "bdfe1347-574f-4829-a745-09ba2176cc2a",
        "name": "image_13.jpeg",
        "original_name": "image_13.jpeg",
        "url": "https://cdn57098163.ahacdn.me/local/cabinet-1/rcIJuNkWmpCQ/image_13.jpeg",
        "thumbnails": {
          "xs": "https://cdn57098163.ahacdn.me/local/cabinet-1/rcIJuNkWmpCQ/image_13_thumb_150.jpeg",
          "small": "https://cdn57098163.ahacdn.me/local/cabinet-1/rcIJuNkWmpCQ/image_13_thumb_500.jpeg",
          "medium": "https://cdn57098163.ahacdn.me/local/cabinet-1/rcIJuNkWmpCQ/image_13.jpeg",
          "large": "https://cdn57098163.ahacdn.me/local/cabinet-1/rcIJuNkWmpCQ/image_13.jpeg",
          "default": "https://cdn57098163.ahacdn.me/local/cabinet-1/rcIJuNkWmpCQ/image_13.jpeg"
        },
        "extension": "jpeg",
        "type_id": 2,
        "mime_type": "image/jpeg"
      },
      "link": "http://test.local/courses/test-chernovik-kvizov",
      "status": {
        "id": 3,
        "name": "Published"
      }
    }
  ],
  "links": {
    "first": "http://api.kwiga.local/courses?page=1",
    "last": "http://api.kwiga.local/courses?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "active": false
      },
      {
        "url": "http://api.kwiga.local/courses?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next &raquo;",
        "active": false
      }
    ],
    "path": "http://api.kwiga.local/courses",
    "per_page": 15,
    "to": 1,
    "total": 1
  }
}

GET https://api.kwiga.com/courses

Cabinet courses list. Pagination is available, default is 15 (max: 15).

URL Parameters

with string[] optional
Array of additional parameters to get along with the course. Possible options: offers (list of all offers with the course), description (info blocks with course description), program (course program tree)
Possible values: offers, description, program
sort_by string optional
Possible values: asc, desc
per_page integer optional
Number of items per page
Maximum: 15
Default: 15
page integer optional
Page number
Default: 1

Course participants list

Request example:

<?php
// Get course users

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/courses/:course/users', $options);

$result = json_decode($response->getBody());
?>


# ---
# Filtered example
# ---

<?php
// Get course users with filters

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/courses/:course/users?progress_general_from=50&progress_general_to=100&per_page=20', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get course users

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/courses/:course/users');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

$result = json_decode($response);
?>


# ---
# Filtered example
# ---

<?php
// Get course users with filters

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/courses/:course/users?progress_general_from=50&progress_general_to=100&per_page=20');
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/courses/:course/users' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'


# ---
# Filtered example
# ---

curl --location --request GET 'https://api.kwiga.com/courses/:course/users?progress_general_from=50&progress_general_to=100&per_page=20' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get course users
const url = 'https://api.kwiga.com/courses/:course/users';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });


# ---
# Filtered example
# ---

// Get course users with filters
const url = 'https://api.kwiga.com/courses/:course/users?progress_general_from=50&progress_general_to=100&per_page=20';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get course users
import requests

url = 'https://api.kwiga.com/courses/:course/users'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()


# ---
# Filtered example
# ---

# Get course users with filters
import requests

url = 'https://api.kwiga.com/courses/:course/users?progress_general_from=50&progress_general_to=100&per_page=20'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

Example of response:

{
    "data": [
        {
            "user": {
                "id": 3,
                "name": "Admin Кабинет",
                "email": "test@test.com"
            },
            "contact": {
                "id": 1,
                "user_id": 3,
                "email": "test@test.com",
                "first_name": "test",
                "last_name": "admin cabinet",
                "phone": "979",
                "created_at": "2023-05-26T09:47:20.000000Z",
                "last_activity_at": null
            },
            "course_points": 0,
            "course_progress": {
                "course_id": 20,
                "course_url": "http://test.local/courses/Pm8CEofJ",
                "title": "Dripping",
                "lessons_count": 9,
                "lessons_count_viewed": 0,
                "lessons_viewed_percentage": 0,
                "lessons_count_completed": 0,
                "lessons_completion_percentage": 0,
                "quizzes_count": 0,
                "quizzes_count_completed": 0,
                "quizzes_completion_percentage": 0,
                "scores_max": 0,
                "quizzes_scores": 0,
                "product_scores": 0,
                "scores": 0,
                "is_completed": false,
                "completed_at": null,
                "current_lesson": {
                    "id": 48,
                    "course_id": 20,
                    "type_id": 1,
                    "status_id": 4,
                    "number": 6,
                    "title": "2",
                    "slug": "2",
                    "link": "http://test.local/courses/Pm8CEofJ/2",
                    "quizzes": [],
                    "module": {
                        "id": 7,
                        "course_id": 20,
                        "number": 1,
                        "title": "Module title"
                    }
                },
                "next_lesson": {
                    "id": 46,
                    "course_id": 20,
                    "type_id": 1,
                    "status_id": 4,
                    "number": 1,
                    "title": "3",
                    "slug": "3",
                    "link": "http://test.local/courses/Pm8CEofJ/3",
                    "module": {
                        "id": 7,
                        "course_id": 20,
                        "number": 1,
                        "title": "Module title"
                    }
                },
                "last_active_at": null,
                "is_checkpoints_skipped": false,
                "checkpoints": [],
                "is_current_dripping_date_skipped": false,
                "is_next_dripping_date_skipped": false,
                "current_dripping_date": null,
                "next_dripping_date": null
            },
            "lessons_available_count": 9,
            "is_full_access": true,
            "subscription": {
                "is_active": true,
                "is_paid": true,
                "start_at": "2024-04-23T13:45:02.000000Z",
                "end_at": null,
                "offer_end_at": null,
                "order_end_at": null,
                "count_available_days": 661,
                "count_left_days": null,
                "state": {
                    "id": 2,
                    "name": "Open",
                    "title": "Open"
                }
            }
        }
    ],
    "links": {
        "first": "http://api.kwiga.local/courses/20/users?page=1",
        "last": "http://api.kwiga.local/courses/20/users?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "&laquo; Previous",
                "active": false
            },
            {
                "url": "http://api.kwiga.local/courses/20/users?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next &raquo;",
                "active": false
            }
        ],
        "path": "http://api.kwiga.local/courses/20/users",
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}

GET https://api.kwiga.com/courses/:course/users

Returns a list of course participants and their progress. Pagination is available, default is 15 (max: 250). Replace :course with the course id that can be obtained from the course editing/management URL or from the course list endpoint.

URL Parameters

search string optional
Fuzzy search by email or name
contact_id integer optional
By contact id
user_id integer optional
By user id
progress_general_from integer optional
General progress from (0 to 99)
progress_general_to integer optional
General progress to (0 to 100)
lessons_viewed_from integer optional
Lesson viewing percentage from (0 to 99)
lessons_viewed_to integer optional
Lesson viewing percentage to (0 to 100)
quizzes_progress_from integer optional
Quizzes progress percentage from (0 to 99)
quizzes_progress_to integer optional
Quizzes progress percentage to (0 to 100)
last_activity_from datetime optional
Last activity on course from (UTC date)
last_activity_to datetime optional
Last activity on course to (UTC date)
per_page integer optional
Number of items per page
Maximum: 250
Default: 15
page integer optional
Page number
Default: 1

Offers

Get offers

Request example:

<?php
// Get offers list filtered by product

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/offers?product_id=130', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get offers list filtered by product

$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>'
// Get offers list filtered by product
const url = 'https://api.kwiga.com/offers?product_id=130';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get offers list filtered by product
import requests

url = 'https://api.kwiga.com/offers?product_id=130'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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"
        }
      ]
    }
  ],
  "links": {
    "first": "http://api.kwiga.local/offers?page=1",
    "last": "http://api.kwiga.local/offers?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "active": false
      },
      {
        "url": "http://api.kwiga.local/offers?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next &raquo;",
        "active": false
      }
    ],
    "path": "http://api.kwiga.local/offers",
    "per_page": 15,
    "to": 1,
    "total": 2
  }
}

GET https://api.kwiga.com/offers

URL Parameters

page integer optional
Page Number
per_page integer optional
Number of fetch items
product_id integer optional
Filter by product
filters object optional
Filter parameters
search string optional
Search

Get offer

Request example:

<?php
// Get offer by ID

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/offers/{id}', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get offer by ID

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$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/{id}' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get offer by ID
const url = 'https://api.kwiga.com/offers/{id}';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get offer by ID
import requests

url = 'https://api.kwiga.com/offers/{id}'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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

GET https://api.kwiga.com/offers/:offer

Marketing. Mailing

Contact List List

Request example:

<?php
// Get contact lists

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/mailing/contact-lists', $options);

$result = json_decode($response->getBody());
?>


# ---
# Paginated example
# ---

<?php
// Get contact lists with pagination

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/mailing/contact-lists?page=1&per_page=15', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get contact lists

$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');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

$result = json_decode($response);
?>


# ---
# Paginated example
# ---

<?php
// Get contact lists 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&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);
?>
curl --location --request GET 'https://api.kwiga.com/mailing/contact-lists' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'


# ---
# Paginated example
# ---

curl --location --request GET 'https://api.kwiga.com/mailing/contact-lists?page=1&per_page=15' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get contact lists
const url = 'https://api.kwiga.com/mailing/contact-lists';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });


# ---
# Paginated example
# ---

// Get contact lists with pagination
const url = 'https://api.kwiga.com/mailing/contact-lists?page=1&per_page=15';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get contact lists
import requests

url = 'https://api.kwiga.com/mailing/contact-lists'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()


# ---
# Paginated example
# ---

# Get contact lists with pagination
import requests

url = 'https://api.kwiga.com/mailing/contact-lists?page=1&per_page=15'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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; translation missing: en.pagination_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": "translation missing: en.pagination_next &raquo;",
                "active": false
            }
        ],
        "path": "https://api.kwiga.com/mailing/contact-lists",
        "per_page": 2,
        "to": 2,
        "total": 3
    }
}

GET https://api.kwiga.com/mailing/contact-lists

URL Parameters

page integer optional
Page Number
limit integer optional
Number of fetch items

Getting a contact list

Request example:

<?php
// Get contact list by ID

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/mailing/contact-lists/{id}', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get contact list by ID

$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/{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/{id}' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get contact list by ID
const url = 'https://api.kwiga.com/mailing/contact-lists/{id}';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get contact list by ID
import requests

url = 'https://api.kwiga.com/mailing/contact-lists/{id}'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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

GET https://api.kwiga.com/mailing/contact-lists/:list

Creating a contact list

Request example:

<?php
// Create contact list

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'title' => 'Название группы',
        'description' => 'описание',
    ],
];

$response = $client->request('POST', '/mailing/contact-lists/', $options);

$result = json_decode($response->getBody());
?>
<?php
// Create contact list

$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/');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$data = [
    'title' => 'Название группы',
    'description' => 'описание',
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($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":"Название группы","description":"описание"}'
// Create contact list
const url = 'https://api.kwiga.com/mailing/contact-lists/';

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'title': 'Название группы',
    'description': 'описание'
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Create contact list
import requests

url = 'https://api.kwiga.com/mailing/contact-lists/'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'title': 'Название группы',
    'description': 'описание',
}

response = requests.post(url, headers=headers, json=data)

result = response.json()

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

POST https://api.kwiga.com/mailing/contact-lists

Request

title string required
Title
description string optional
Description

Adding Contacts to a List

Request example:

<?php
// Bulk add contacts to lists

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'contacts[]' => 1,
        'contacts[]' => 2,
        'contact_lists[]' => 1,
    ],
];

$response = $client->request('POST', '/mailing/contact-lists/bulk-contacts', $options);

$result = json_decode($response->getBody());
?>
<?php
// Bulk add contacts to lists

$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/bulk-contacts');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$data = [
    'contacts[]' => 1,
    'contacts[]' => 2,
    'contact_lists[]' => 1,
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($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[]":2,"contact_lists[]":1}'
// Bulk add contacts to lists
const url = 'https://api.kwiga.com/mailing/contact-lists/bulk-contacts';

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'contacts[]': 1,
    'contacts[]': 2,
    'contact_lists[]': 1
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Bulk add contacts to lists
import requests

url = 'https://api.kwiga.com/mailing/contact-lists/bulk-contacts'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'contacts[]': 1,
    'contacts[]': 2,
    'contact_lists[]': 1,
}

response = requests.post(url, headers=headers, json=data)

result = response.json()

Example of response:

{
    "success": true
}

POST https://api.kwiga.com/mailing/contact-lists/bulk-contacts

URL Parameters

contacts integer[] required
Contacts (ID)
contact_lists integer[] required
Contact Lists (ID)

Payments. Coupons

Coupon list

Request example:

<?php
// Get coupons list

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/coupons', $options);

$result = json_decode($response->getBody());
?>


# ---
# Filtered example
# ---

<?php
// Get coupons list with date filters

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/coupons?filters[date_from]=2022-04-15&filters[date_to]=2022-04-27', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get coupons list

$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);
?>


# ---
# Filtered example
# ---

<?php
// Get coupons list with date filters

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


# ---
# Filtered example
# ---

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>'
// Get coupons list
const url = 'https://api.kwiga.com/coupons';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });


# ---
# Filtered example
# ---

// Get coupons list with date filters
const url = 'https://api.kwiga.com/coupons?filters[date_from]=2022-04-15&filters[date_to]=2022-04-27';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get coupons list
import requests

url = 'https://api.kwiga.com/coupons'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()


# ---
# Filtered example
# ---

# Get coupons list with date filters
import requests

url = 'https://api.kwiga.com/coupons?filters[date_from]=2022-04-15&filters[date_to]=2022-04-27'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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

filters object optional
Filter parameters
date_from datetime optional
Filter by creation date. Parameter 'from'
date_to datetime optional
Filter by creation date. 'To' parameter

Getting a coupon

Request example:

<?php
// Get coupon by ID

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/coupons/{id}', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get coupon by ID

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$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/{id}' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get coupon by ID
const url = 'https://api.kwiga.com/coupons/{id}';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get coupon by ID
import requests

url = 'https://api.kwiga.com/coupons/{id}'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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

GET https://api.kwiga.com/coupons/:coupon

Create coupon

Request example:

<?php
// Create coupon

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'code' => 'MY-COUPON',
        'reward' => 0,
        'type_discount[id]' => 'discount_with_percent',
        'expires_at' => ,
        'timezone[id]' => 375,
        'total_uses' => 0,
        'total_uses_per_user' => 0,
    ],
];

$response = $client->request('POST', '/coupons', $options);

$result = json_decode($response->getBody());
?>
<?php
// Create coupon

$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);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$data = [
    'code' => 'MY-COUPON',
    'reward' => 0,
    'type_discount[id]' => 'discount_with_percent',
    'expires_at' => ,
    'timezone[id]' => 375,
    'total_uses' => 0,
    'total_uses_per_user' => 0,
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$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":0,"type_discount[id]":"discount_with_percent","expires_at":null,"timezone[id]":375,"total_uses":0,"total_uses_per_user":0}'
// Create coupon
const url = 'https://api.kwiga.com/coupons';

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'code': 'MY-COUPON',
    'reward': 0,
    'type_discount[id]': 'discount_with_percent',
    'expires_at': ,
    'timezone[id]': 375,
    'total_uses': 0,
    'total_uses_per_user': 0
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Create coupon
import requests

url = 'https://api.kwiga.com/coupons'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'code': 'MY-COUPON',
    'reward': 0,
    'type_discount[id]': 'discount_with_percent',
    'expires_at': ,
    'timezone[id]': 375,
    'total_uses': 0,
    'total_uses_per_user': 0,
}

response = requests.post(url, headers=headers, json=data)

result = response.json()

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

POST https://api.kwiga.com/coupons

URL Parameters

code string optional
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`
Example: discount_with_percent or discount_with_currency
expires_at datetime optional
Coupon validity period. If null or not specified, then indefinitely
Example: 2024-12-31 or 2024-12-31 23:59:59
timezone.id integer optional
Time zone of coupon expiration date
total_uses integer optional
Limit on the number of times a coupon can be used. 0 - unlimited
total_uses_per_user integer optional
Limit on the number of times a coupon can be used by one user

Check coupon

Request example:

<?php
// Check coupon validity

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
    'json' => [
        'code' => 'VAJ6-EA',
        'price' => 65,
    ],
];

$response = $client->request('POST', '/coupons/check', $options);

$result = json_decode($response->getBody());
?>
<?php
// Check coupon validity

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/coupons/check');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$data = [
    'code' => 'VAJ6-EA',
    'price' => 65,
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

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

$result = json_decode($response);
?>
curl --location --request POST 'https://api.kwiga.com/coupons/check' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>' \
--data-raw '{"code":"VAJ6-EA","price":65}'
// Check coupon validity
const url = 'https://api.kwiga.com/coupons/check';

const options = {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
  body: JSON.stringify({
    'code': 'VAJ6-EA',
    'price': 65
  })
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Check coupon validity
import requests

url = 'https://api.kwiga.com/coupons/check'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

data = {
    'code': 'VAJ6-EA',
    'price': 65,
}

response = requests.post(url, headers=headers, json=data)

result = response.json()

Example of response:

{
  "data": {
    "can_use": true,
    "discount": 6.5
  }
}

POST https://api.kwiga.com/coupons/check

Checks coupon for existence and usability (limit not exhausted / not expired).
Note: when used on checkout page, the coupon may not be applied under the following conditions: if the use of coupons/this coupon is disabled on the offer; there are restrictions on the coupon by contact lists; the user has already used the coupon and there is a limit on the number of uses on the coupon.

Parameters

code string required
Coupon code to check
price number optional
Price for discount calculation. If specified, the discount value will be returned in the discount field in the response

Certificates

Receiving a certificate by number

Request example:

<?php
// Get certificate by number

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/certificates/by-number/{number}', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get certificate by number

$headers = [
    'Accept: application/json',
    'Token: <Token>',
    'Cabinet-Hash: <Cabinet-Hash>',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.kwiga.com/certificates/by-number/{number}');
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/{number}' \
--header 'Content-Type: application/json' \
--header 'Token: <Token>' \
--header 'Cabinet-Hash: <Cabinet-Hash>'
// Get certificate by number
const url = 'https://api.kwiga.com/certificates/by-number/{number}';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get certificate by number
import requests

url = 'https://api.kwiga.com/certificates/by-number/{number}'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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

GET https://api.kwiga.com/certificates/by-number/:number

Timezones

Getting a list of time zones

Request example:

<?php
// Get timezones list

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://api.kwiga.com']);

$options = [
    'headers' => [
        'Accept' => 'application/json',
        'Token' => '<Token>',
        'Cabinet-Hash' => '<Cabinet-Hash>',
    ],
];

$response = $client->request('GET', '/timezones', $options);

$result = json_decode($response->getBody());
?>
<?php
// Get timezones list

$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>'
// Get timezones list
const url = 'https://api.kwiga.com/timezones';

const options = {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
  },
};

fetch(url, options)
  .then(response => response.json())
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error('Error:', error);
  });
# Get timezones list
import requests

url = 'https://api.kwiga.com/timezones'

headers = {
    'Accept': 'application/json',
    'Token': '<Token>',
    'Cabinet-Hash': '<Cabinet-Hash>',
}

response = requests.get(url, headers=headers)

result = response.json()

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