Skip to main content

Get a Promotion Code Usage

GET Get a Promotion Code Usage

https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/codes/:code/usages

This endpoint retrieves the usage history of a specific promotion code within a specific promotion, including details like order_id, code, and times_used.

Parameters

Path parameters

NameRequiredTypeDescription
promotionIDRequiredstringThe unique identifier for the rule promotion.
codeRequiredstringSpecifies the name of the code. For example, 10OFF.

Headers

NameRequiredTypeDescription
AuthorizationRequiredstringThe Bearer token required to get access to the API.

Query parameters

NameRequiredTypeDescription
filterOptionalstringFilter attributes. For more information, see Filtering.
page[limit]OptionalintegerThe number of records per page.
page[offset]OptionalintegerThe number of records to offset the results by.
sortOptionalstringSupported attribute is used_on. When specified, the results are sorted in an ascending order. To sort in descending order, prefix the attribute with -, for example, -used_on. See Sorting.

Filtering

The following operators and attributes are available for filtering usages:

AttributeTypeOperatorsExample
idstringeqeq(id,8dac76b3-9282-4730-b1dd-bdd2a95610cb)
codestringeqeq(code,cart1off)
used_onstringgt,ge,le and ltgt(used_on,2023-07-11)

Request Example

curl https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/codes/:code/usages \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \

Response Example

When a cart with a promotion is checked out using an accountID, the accountID will be included in the response.

200 OK

{
"data": [
{
"id": "96a80700-4895-4d74-b96f-3ea39417ed29",
"order_id": "5728c924-cd08-4b4a-a36a-1a926ee92ad3",
"code_id": "fd23fcc6-e2cc-4900-9505-d38147c3019a",
"code": "bxgy",
"times_used": 1,
"used_on": "2024-08-15T18:25:41.209Z",
"customer_email": "andy@example.com",
"meta": {
"timestamps": {
"updated_at": "2024-08-15T18:25:41.209Z"
}
},
"anonymized": false,
"account_id": "c40ee30c-f5f9-4a40-8f3f-08f7c652b0c5"
}
],
"links": {
"current": "https://useast.api.elasticpath.com/v2/rule-promotions/26067b82-a50c-462c-b3ed-1ca77aa13bd1/usages?page[offset]=0&page[limit]=10",
"first": "https://useast.api.elasticpath.com/v2/rule-promotions/26067b82-a50c-462c-b3ed-1ca77aa13bd1/usages?page[offset]=0&page[limit]=10",
"last": "https://useast.api.elasticpath.com/v2/rule-promotions/26067b82-a50c-462c-b3ed-1ca77aa13bd1/usages?page[offset]=0&page[limit]=10",
"prev": "https://useast.api.elasticpath.com/v2/rule-promotions/26067b82-a50c-462c-b3ed-1ca77aa13bd1/usages?page[offset]=0&page[limit]=10",
"next": "https://useast.api.elasticpath.com/v2/rule-promotions/26067b82-a50c-462c-b3ed-1ca77aa13bd1/usages?page[offset]=0&page[limit]=10"
},
"meta": {
"page": {
"limit": 10,
"offset": 0,
"current": 1,
"total": 1
},
"results": {
"total": 1
}
}
}