17. API Redeem Voucher
This API is served by the Background Service via the API Ring router.
Endpoint
Base Path:
{API_PREFIX}/history-coupon-codeMethod:
GETHeaders:
apikey: <your-api-key>
Query Parameters
code(optional)
Exact coupon code to search.
coupon(optional)
Coupon program ID (coupon._id).
createdAtRangeFrom(optional)
Inclusive start time in epoch milliseconds.
createdAtRangeTo(optional)
Inclusive end time in epoch milliseconds.
If no date range is provided, the API returns all history records for the organization.
Response
Returns a list of history entries belonging to the caller's organization. All relational fields are populated.
Response Fields
id
History entry ID
code
Coupon code string
coupon
Populated coupon document (id, name, …)
contact
Populated contact document
createdBy
Populated user who sent the coupon
createdAt
Timestamp in milliseconds
coupon_code
Reference to the coupon code document
phoneSend
Phone number used to send the coupon
org
Organization ID
Example Request
Example Response
Notes
Requires a valid API Ring token; results are scoped to the org from
apiRingSetting.Use pagination at the HTTP gateway if needed; the route currently returns all matched records.
GET /coupons
/couponsEndpoint
Method:
GETURL:
/couponsHeaders:
apikey: <your-api-key>
Query Parameters
text
string
No
Search by name (supports regex + Vietnamese normalization).
dateNow
number
No
Filter coupons whose endTime is in the future or not set.
status
string
No
Time-based status filter: NOT_STARTED, IN_PROGRESS, ENDED.
status Rules
status RulesNOT_STARTED →
startTimenot reached or not setIN_PROGRESS → active period (startTime ≤ now and endTime not passed)
ENDED →
endTimehas passed
Example Response
GET /coupon-codes
/coupon-codesReturns the list of actual coupon codes under a specific coupon program.
🔗 Endpoint
Method:
GETURL:
/coupon-codesHeaders:
apikey: <your-api-key>
Query Parameters
coupon
string
Yes
Coupon program ID.
status
number
No
Filter by voucher status:
0 – unused
1 – used but still valid
2 – exceeded limit / invalid
Example Response
Last updated