API: Code Query API
The Code Query API can be used to to check the promotion details for a given coupon code. It will also return the code validity and any redemptions for the given code in the response.
End Point
https://api.uniqodo.com/publisher/API_KEY/query/user-redemption/PROMOTION_UUID?userId=USER_IDENTIFIER
Example API Call
https://api.uniqodo.com/publisher/64a287ae534cf1bd58f45f3e23de9d433caec669/query/user-redemption/0821f4190897965c33eaca7954db5f23?userId=ABC123
Parameter | Description | Format | Required |
api_key | The API key assigned to the distributor. | 64a287ae534cf1bd58f45f3e23de9d433caec669 | Yes |
promotion_uuid | The promotion for which you want redemption history | 0821f4190897965c33eaca7954db5f23 | Yes |
userId | The ID of the user to query (eg. the email address stored when redeemed) | ABC123 | Yes |
Response
The response data are indexed under the related entity within the data
key.
{
"data": {
"redemption": {
"records": [{
"id": 1925118,
"offer_id": 4883,
"merchant_id": 1,
"distributor_id": 102,
"code": "BF39KD2H",
"order_id": "1262434SH",
"order_value": 45,
"discount_value": 11.25,
"currency": "GBP",
"custom_params": null,
"redeemed_at": "2019-05-15T08:55:37+0100",
"tags": []
}],
"total": 1
},
"offer": {
"id": 4883,
"offer_id": 4883,
"offer_description": "Unique coupon test promotion",
"merchant_id": 1,
"merchant_name": "Uniqodo Test",
"description": "Test promotion",
"status": "active",
"code": "XMAS10",
"terms": null,
"code_remaining": 1000,
"redemption_per_code": 1,
"code_type": "unique",
"start_date": "27-02-2019 00:00:00",
"end_date": "17-05-2019 23:59:59",
"code_issue_date": "15-05-2019 08:54:02",
"code_expiry": ""
}
},
"errors": [{
"code": 201,
"message": "This code has already been redeemed and can no longer be used.",
"promotion_specific_error": null
}]
}
{
"data": {
"redemption": {
"records": [],
"total": 0
},
"offer": null
},
"errors": [{
"code": 204,
"message": "The code entered is not recognised.",
"promotion_specific_error": null,
"reference": "TCJGGJGF"
}],
"result": "failure"
}
Redemption Data - |
Item | Description | Example |
total | The total number of redemptions (transactions) that have taken place through the use of the code. | 3 |
Item (under | Description | Example |
id | A unique ID for the code redemption. | 126478 |
offer_id | The ID of the offer associated with the given code. | 1256 |
code | The code being checked. | 2HDG2KJ3 |
redeemed_at | The date and time that the code redemption occurred. | 2015-05-29T10:39:17 |
order_id | The merchant’s unique ID or reference for the transaction. | ABC145789 |
order_value | The value of the transaction, excluding VAT. | 219.99 |
discount_value | The computed value based on the offer discount information and the order_value. | 11.25 |
distributor_id | The ID of the distributor that issued the code to customers. | 106 |
currency | The currency in which the transaction took place. | GBP |
custom_params | The serialised, custom parameter data submitted with the redemption API for reporting and data segmentation purposes. | {\"p1\":\"example1\", |
merchant_id | The ID of the merchant redeeming the code. This is useful when an offer is shared between multiple merchant accounts. | 2 |
tags | Tags are a list of labels configured for the offer. | [ "SUMMER_OFFER", "ONLINE" ] |
Code Validity Errors - under the errors
key
Any errors returned here indicates that the code is not valid for use by customers.
Please see the 'errors' section of the Validation API documentation here https://uniqodo.helpdocs.io/article/2KtEar68G3-merchant-validation-api-documentation