Coupontools Logo

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.

Create a single use access URL for a coupon directory

Create a single use URL for a coupon directory.
You can already preload data from the consumer to this URL. (first name, last name, email, phone)
You can also add the start and enddate in UTC time for this URL.
Base URL
POST: https://api4coupons.com/v3/directorysingleuse/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 directory The unique ID from the directory Can be found in the list of all directories.
Required
4 firstname Add the first name to this single use URL.
Optional
5 lastname Add the last name to this single use URL.
Optional
6 email Add the email address to this single use URL.
Optional
7 phone Adds the phone number to this single use URL.
Optional
8 customid Adds a custom ID to this single use URL. Max 50 characters (az-AZ-09)
Optional
9 startdate Adds a start date + time (UTC) to this single use URL. If not added, the startdate value will be the creation date.
Optional
10 enddate Adds a end date + time (UTC) to this single use URL. If not added, there will not be an expiry date for this URL.
Optional
<?php
	$ch = curl_init();
	$url = "https://api4coupons.com/v3/directorysingleuse/create";
	$client_id = "XXX"; // Your API client ID (required)
	$client_secret = "YYY"; // Your API client secret (required)
	$data = [
		'directory' => "dir_12345"
	];
	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"
			},
			"directory": "dir_12345",
			"action": "single_use_code_created",
			"single_use_code": "gzff5j1zkbpbyrpjusdtz",
			"single_use_url": "https://couponapp.directory/index.php?dir=PFQHs5chqBs13G7jQjIOG&su=gzff5d1zpbpbyrpjusdtz",
			"startdate": "2017-12-31 0:00", (UTC)
			"enddate": "2018-12-31 0:00" (UTC)
		}
		

Register now for a 7-days trial account

Start using Coupontools today!

Great you're here! Cookies? Read our Privacy Policy. I accept
x