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
Update the data from a campaign session
Allows you to update the data from 1 campaign session. For example to set one coupon session to validated or claimed status.Base URL
POST: https://api4coupons.com/v3/couponsession/update
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 | couponsession | The unique session code (example: ac6s7u3g8a25ja7x9qg87 or ac6s7u) | Can be found in the URL or webhooks or API call to retrieve all data from a campaign. |
Required
|
4 | operation | void unvoid lock unlock claim validate unvalidate activate |
void will set the coupon session to voided status unvoid will unset the voided status lock will set the coupon session to locked status unlock will unset the locked status claim will set the coupon session to claimed status. validate will set the coupon session to validated status. unvalidate will set the coupon session to unvalidated status. Activate will unvoid and start the session, if the coupon has a flexible expiry date, the expiration time will be calculated. |
Optional
|
5 | customfield1 through customfield7 | Add additional data to custom field 1 through 7 | Max 50 characters |
Optional
|
6 | customid | Adds a custom ID to this single use URL. | Max 50 characters (az-AZ-09) |
Optional
|
7 | money_spent | Adds data to money spent. | (Format: 0.000) Do not use special characters |
Optional
|
<?php $ch = curl_init(); $url = "https://api4coupons.com/v3/couponsession/update"; $client_id = "XXX"; // Your API client ID (required) $client_secret = "YYY"; // Your API client secret (required) $data = [ 'couponsession' => "ac6s7u3g8a25ja7x9qg87" ]; 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": "update_session", "action_date": "2019-04-10 11:35:36", "session": "et4ufwqsnqc8r9ckrki6m", "customid": "", "operation": "validate_succesful" }
Example error response
{ "status": { "status": "failed", "errors": { "error_message": "HTTP/1.0 422 Unprocessable entity.", "error_message_description": [ "Session already was validated before." ], "error_code": [ 358 ] } } }
Possible errors
- 200: Missing parameter: couponsession
- 300: Invalid character in parameter: couponsession.
- 300: Invalid character in parameter: customid.
- 302: Invalid value in parameter: operation
- 351: Session is expired.
- 351: Session or coupon has expired
- 352: Session already was claimed before.
- 352: Session could not be locked because it is not claimed.
- 353: Session was already unvalidated
- 354: This coupon is locked.
- 354: Session already was locked before.
- 358: Session already was validated before.
- 355: Session could not be locked because it is voided.
- 355: Session could not be unlocked because it is voided.
- 355: Session was already voided.
- 355: This coupon is voided.
- 356: Session was already unlocked
- 357: Session wasn't void
- 358: This session was already validated.
- 358: Session could not be locked because it is already validated.
- 360: Session or coupon has not reached startdate yet
- 361: Max coupons exceeded
- 512: Coupon session not found.