API & Webhooks
Connect the Coupontools platform with your apps or web projects. The Coupontools REST API allows you to query meta-data about your account, campaigns, distribution, validations, and usage data.
-
Subaccount
- Retrieve a list of subaccounts
- Retrieve info of a subaccount
- Create a subaccount
- Update a subaccount
- Create password reset url for subaccount
- Single sign on for subaccounts
-
Campaign
- Retrieve a list of your campaigns
- Retrieve information from a campaign
- Retrieve all usage data from a campaign
- Retrieve all data from one coupon session
- Update data from a coupon session
- Update data from multiple coupon sessions
- Search coupon session
- Search coupon session from a campaign
- Send single push notification
- Send push notification to all
-
Loyalty Card
- Retrieve a list of your loyalty cards
- Retrieve a list of users from a loyalty card
- Update loyalty card user
- Send single push notification
- Send push notification to all
-
Directory
- Retrieve a list of your directories
- Retrieve information from a directory
- Retrieve all campaigns from a directory
- Retrieve registered users from a directory
- Update directory user payment status
- Retrieve a list of categories
- Retrieve a list of 3rd level categories
-
Single Use
- Create a single use access URL
- Create multiple single use access URLs
- Remove a single use access URL
Create multiple single use access URLs
Create multiple single use URL for a campaign.Base URL
POST: https://api4coupons.com/v3/multiplesingleuse/create
Parameters
# | Parameter | Input | Description | |
---|---|---|---|---|
1 | client_id | API client ID | Can be found in your API documentation | Required |
2 | client_secret | API client secret | Can be found in your API documentation | Required |
3 | campaign | The unique ID from the campaign | Can be found in the list of all campaigns. |
Required
|
4 | amount | The amount of single use codes to generate | Default=10. Maximum=100000. Only digits allowed. |
Optional
|
5 | status | normal, voided or activated | Defaults to normal. |
Optional
|
6 | automated_codes | true or false | If custom validation codes should be generated, defaults to false, requires the following parameters |
Optional
|
6.1 | code_prefix | the prefix of the custom validation code |
Optional
|
|
6.2 | code_length | a number between 10 and 25 inclusive | The length of the custom validation code after the prefix |
Optional
|
6.3 | code_type | numeric or alphanumeric | The type of the custom validation code |
Optional
|
<?php $ch = curl_init(); $url = "https://api4coupons.com/v3/multiplesingleuse/create"; $client_id = "XXX"; // Your API client ID (required) $client_secret = "YYY"; // Your API client secret (required) $data = [ 'campaign' => "cam_123456" ]; curl_setopt($ch, CURLOPT_URL, "$url"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "X-Client-Id: $client_id", "X-Client-Secret: $client_secret", "Content-Type: application/json", ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); $response = curl_exec($ch); ?>
Example response
{ "status": { "status": "OK" }, "campaign": "cam_15111", "action":" multiple_single_use_codes_created", "data": [ { "single_use_code": "5f3jupt49d27udvwpnsar", "sequence_id": 18001837, "single_use_url": "https://digicpn.com/p/xpw9cr/5f3jupt49d27udvwpnsar", "widget_validation_code": "5f3jup", "custom_validation_code": "test_MPwV4DdaE", "expirydate": "2019-04-02 11:51:41", (only generated and shown when the status is activated) "create_date": "2019-04-01 11:51:41", "voided": "0" }, { "single_use_code": "15rvagf7en5vc8nqbjqgv", "sequence_id": 18001838, "single_use_url": "https://digicpn.com/p/xpw9cr/15rvagf7en5vc8nqbjqgv", "widget_validation_code": "15rvag", "custom_validation_code": "test_AtaYhJs5p5", "expirydate": "2019-04-02 11:51:41", "create_date": "2019-04-01 11:51:41", "voided": "0" }, { "single_use_code": "95z0iap4a4mj5q3uqfus9", "sequence_id": 18001839, "single_use_url": "https://digicpn.com/p/xpw9cr/95z0iap4a4mj5q3uqfus9", "widget_validation_code": "95z0ia", "custom_validation_code": "test_6kp0vstrgn", "expirydate": "2019-04-02 11:51:41", "create_date": "2019-04-01 11:51:41", "voided": "0" } ] }
Possible errors
- 200: Missing parameter: campaign
- 301: Invalid character in parameter: amount.
- 301: code length must be between 3 and 30 inclusive
- 301: Invalid character in parameter: campaign.
- 302: code_type must be "numeric" or "alphanumeric"
- 302: Parameter "status" has invalid value. Possible values are "normal", "voided" and "active".
- 502: Campaign ID not found.
- 601: low on unique generated validation codes