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.

Retrieve all data from a campaign

Returns a list of all sessions from a campaign.
Base URL
POST: https://api4coupons.com/v3/campaign/data
Base URL for opens
POST: https://api4coupons.com/v3/campaign/opens
Base URL for only claims & validations
POST: https://api4coupons.com/v3/campaign/claims
Base URL for only validations
POST: https://api4coupons.com/v3/campaign/validations
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 ID from the campaign Can be found in the list of all campaigns.
Required
4 page ID from the page Default=1. If there are 5000 or more records these will be split in multiple pages.
Optional
5 start_date Start date of the sessions in UTC Inclusive. Must be format 'yyyy-mm-dd hh-mm' or 'yyyy-mm-dd'
Optional
6 end_date End date of the sessions in UTC Inclusive. Must be format 'yyyy-mm-dd hh-mm' or 'yyyy-mm-dd'
Optional
<?php
	$ch = curl_init();
	$url = "https://api4coupons.com/v3/campaign/data";
	$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_12345",
			"action": "retrieve_all_data",
			"data": [
				{
					"session": "kkfiznr8gp8630h82es8d",
					"sequenceid": "19878460",
					"status": {
						"created_date_utc": "2019-03-25 10:43:50",
						"opened": "0",
						"open_date_utc": "",
						"played": "0",
						"played_date_utc": "",
						"claimed": "1",
						"claim_date_utc": "2019-03-25 10:44:05",
						"claimtype": "",
						"saved_to_passbook": "0",
						"saved_to_passbook_date_utc": "",
						"saved_to_androidpay": "0",
						"saved_to_androidpay_date_utc": "",
						"validated": "0",
						"validation_date_utc": "",
						"own_validation_code": "ding_COdHepKvqNrNC8OU",
						"validation_value": "",
						"redeem_location_ID": "",
						"voided": "0",
						"unvoided_date_utc": "2019-03-25 10:44:05",
						"locked": "0",
						"unlocked_date_utc": "",
						"value": "",
						"customid": "",
						"expiration_date": "2019-03-02 02:00:00",
						"utm_campaign": null,
						"utm_source": null,
						"utm_medium": null,
						"utm_term": null,
						"utm_content": null,
						"redeem_location_company_name": "Show",
						"redeem_location_street": "street",
						"redeem_location_zip": "",
						"redeem_location_city": "Foo",
						"redeem_location_province": "Bar",
						"redeem_location_country": "Baz",
						"redeem_location_phone": "",
						"redeem_location_website": "https://www.coupontools.com",
						"redeem_location_pincode": "aSQbSs"
					},
					"user": {
						"gender": "Male",
						"first_name": "John",
						"last_name": "Johnson",
						"address": "Wallstreet 1",
						"zip": "10000",
						"city": "New York",
						"birthday": "1970-01-01",
						"email": "info@mymailbox.com",
						"phone": "1234567890",
						"answer": "yes",
						"custom1": "A",
						"custom2": "B",
						"custom3": "C",
						"custom4": "D",
						"custom5": "E",
						"custom6": "F",
						"custom7": "G",
						"customid": "1A2B",
						"checkbox1": "1",
						"checkbox2": "0",
						"checkbox3": "1",
						"checkbox4": "0",
						"device": "Windows",
						"profile_picture": "",
						"ip_lat": "",
						"ip_long": ""
					},
					"campaign": {
						"ID": "cam_1010951",
						"code": "v6n7gn",
						"url": "https://digicpn.com/p/v6n7gn",
						"status": "test",
						"coupon_tags": ""
					}
				]
			}
		}
		
Possible errors
  • 200: Missing parameter: campaign
  • 301: Invalid character in parameter: campaign.
  • 301: Invalid character in parameter: page.
  • 303: Parameter end_date is not a valid date
  • 303: Parameter end_date must be in the following format: yyyy-mm-dd hh:mm or yyyy-mm-dd
  • 303: Parameter start_date is not a valid date
  • 303: Parameter start_date must be in the following format: yyyy-mm-dd hh:mm or yyyy-mm-dd
  • 502: Campaign ID not found.

  • Regístrate ahora para una cuenta de prueba por 7 días

    ¡Empieza a usar Coupontools hoy!

¡Genial, estás aquí! ¿Cookies? Lee nuestrasPolíticas de Privacidad. Yo acepto
x