Get Codes
Allows you to fetch codes that are ready for use within specific orders. As our system fulfills an order, codes will be progressively available for each individual product. You have the flexibility to fetch codes either partially as they become available or fully in a single request.
GET /v2/orders/{transactionId}/codes
​
Request​
HTTP Headers​
To use this endpoint, the following headers are required for authentication:
Header | Type | Required | Description |
---|---|---|---|
x-api-key | String | Yes | API key assigned to your account for accessing the service. |
Authorization | String | Yes | Bearer token for authenticating the API request. |
Path Parameters​
Parameter | Type | Required | Description |
---|---|---|---|
transactionId | String | Yes | Unique identifier of the transaction to retrieve codes for. |
Query Parameters​
Optionally, you can include the following parameters to filter the codes retrieval:
Parameter | Type | Required | Default Value | Description |
---|---|---|---|---|
sku | String | No | None | Optional filter by product SKU. |
stockIds | String | No | None | Optional filter by list of EZ stock identifiers. |
Example Request​
GET /v2/orders/trans_1234567890/codes?sku=8PX-UF-Y5U&status=COMPLETED HTTP/1.1
Host: api.example.com
Content-Type: application/json
x-api-key: <API_KEY>
Authorization: Bearer <BEARER_ACCESS_TOKEN>
Response​
HTTP Status Codes​
Status Code | Description |
---|---|
200 | OK - The codes associated with the specified order are returned successfully. |
400 | Bad Request - The request was invalid, often due to incorrect path or query parameters. |
404 | Not Found - The specified codes could not be found. |
500 | Internal Server Error - An error occurred on the server side. |
Schema​
Property | Type | Nullable | Description |
---|---|---|---|
requestId | String | No | Unique identifier assigned to each request for tracking purposes. |
data | ProductResponse[] | No | List of product in the order. |
ProductResponse​
Property | Type | Nullable | Description |
---|---|---|---|
sku | String | No | The SKU of the product. |
quantity | Integer | No | The quantity of the product. |
codes | CodeResponse | No | List of codes in the product. |
CodeResponse​
Property | Type | Nullable | Description |
---|---|---|---|
stockId | Integer | No | The unique identifier of the stock. |
status | CodeStatus | No | The status of the code. |
redeemCode | String | Yes | The redeemable code for the product (can be null if not available). |
pinCode | Integer | Yes | The PIN code for the product (can be null if not available). |
CodeStatus​
Value | Type | Description |
---|---|---|
PROCESSING | String | The code is currently being processed. |
COMPLETED | String | The code has been completed successfully. |
Example 200 OK Response​
{
"requestId": "c4c7b997-79a5-4bde-9f17-47ad7eac9ed4",
"data": [
{
"sku": "8PX-UF-Y5U",
"quantity": 100,
"codes": [
{
"stockId": 1,
"status": "COMPLETED",
"redeemCode": "J72D-I83E-N87F-213E-B980-K915",
"pinCode": 1234
},
{
"stockId": 2,
"status": "PROCESSING",
"redeemCode": null,
"pinCode": null
}
]
}
]
}