Skip to main content

Campaign Detail Endpoint

Returns one campaign together with the coupons the current user can act on. Each entry in coupons carries one concrete coupon code, so the list is what you render as the campaign's coupon cards.

  • Endpoint: /api/v1/campaigns/{slug}
  • Method: GET or POST

Headers

HeaderValueRequiredDescription
Partner-Access-TokenBase64 StringYesYour encrypted AES-256 time-sensitive token.
AuthorizationBearer <token>OptionalSanctum token of the signed-in user. See the note below.
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
X-Currencye.g. THBOptionalCurrency for all money fields. Defaults to THB.

Path Parameters

ParameterTypeRequiredDescription
slugStringYesCampaign slug from the Campaign List response.

Payload Parameters

ParameterTypeRequiredDescription
pageIntegerOptionalAccepted for compatibility. Coupons are returned unpaginated.
limitIntegerOptionalAccepted for compatibility. Coupons are returned unpaginated.

Sample Response

{
"result": 1,
"message": "success",
"data": {
"campaign": {
"id": 41,
"name": "Songkran Hotel Sale",
"slug": "songkran-hotel-sale",
"status": "running",
"promotion_type": "coupon",
"start_at": "2026-04-01T00:00:00.000000Z",
"end_at": "2026-04-30T23:59:59.000000Z",
"coupon_expiry": "2026-05-31T23:59:59.000000Z",
"description": "Save on hotel stays across Thailand.",
"term_and_conditions": "<p>One coupon per booking.</p>",
"images": [
"https://api.dev.onlynx.co.th/storage/campaigns/songkran-banner.jpg"
]
},
"coupons": [
{
"id": 96,
"currency": "THB",
"coupon_id": 5821,
"code": "SONGKRAN10",
"status": "not_issued",
"discount_type": "percentage",
"discount_value": 10,
"min_purchase_amount": 1000,
"max_discount_amount": 500,
"is_same_code": true,
"coupon_expiry": "2026-05-31T23:59:59.000000Z",
"claim_expiry": "2026-04-03T09:00:00.000000Z",
"rules": [
"Save up to THB 500",
"Min. spend THB 1000"
],
"applicable_for": "Valid for <strong>Hotel</strong> in <strong>Thailand</strong>",
"campaign": {
"id": 41,
"name": "Songkran Hotel Sale",
"slug": "songkran-hotel-sale",
"status": "running",
"promotion_type": "coupon",
"start_at": "2026-04-01T00:00:00.000000Z",
"end_at": "2026-04-30T23:59:59.000000Z",
"coupon_expiry": "2026-05-31T23:59:59.000000Z",
"description": "Save on hotel stays across Thailand.",
"term_and_conditions": "<p>One coupon per booking.</p>",
"images": []
}
}
]
}
}

Coupon Field Reference

FieldTypeDescription
idIntegerCoupon (discount setting) ID. Use it in the Coupon Codes endpoint.
coupon_idIntegerCoupon code row ID. Use it in the Delete Claimed Coupon endpoint.
codeStringThe code the user claims and later applies.
currencyStringCurrency of every money field below.
statusStringnot_issued, claimed, redeemed, expired, fully redeemed, reserved.
discount_typeStringpercentage or fixed.
discount_valueNumberPercent when percentage; converted money amount when fixed.
min_purchase_amountNumberMinimum cart total required. 0 means no minimum.
max_discount_amountNumberDiscount cap for percentage coupons. 0 means uncapped.
is_same_codeBooleantrue when every user shares one code, false for unique per-user codes.
coupon_expiryDateTime | nullWhen the code stops working.
claim_expiryDateTime | nullDeadline to use the code after claiming it. null until claimed.
rulesArray<String>Ready-to-render bullet points built from the amounts above.
applicable_forStringHuman readable restriction summary, contains <strong> tags.
campaignObjectThe parent campaign, same shape as data.campaign.

Notes

Send the user token. This route sits outside the authenticated group, so the bearer token is optional — but without it the response only contains unclaimed codes. With it, the coupons the user already claimed come back with status: "claimed" in the same list, and the number of cards stays stable before and after a claim.

  • One coupon may appear several times, once per code the user is still entitled to. The number of entries per coupon is capped by that coupon's usage_limit_per_user.
  • Coupons with no code left for this partner are omitted entirely.
  • A slug that is missing, inactive, out of its timeline, or fully redeemed returns:
{
"result": 0,
"message": "Campaign not found or inactive"
}

with HTTP status 404.