CRUD for promotion campaigns: the audience receives an amount — spendable credit
for a client, wallet money for a driver. trigger_type says whether the campaign
fires on a delivery or is handed out by an admin. qualifying_order_kind and
min_order_amount_cents say which deliveries count, milestone_basis whether
they are counted over the party's whole history or only from the campaign's
start, and reward_type whether the amount is flat or a capped percentage of the
order. Paths are relative to the /api/v1 prefix; these are back-office
endpoints requiring a super-admin token.
Requires a super-admin bearer token (see Admin auth). Super-admin only.
See Common errors.
| Method | URI | Access | Description |
|---|---|---|---|
GET |
/admin/promotions |
Super admin | List campaigns |
POST |
/admin/promotions |
Super admin | Create a campaign |
GET |
/admin/promotions/{promotionId} |
Super admin | Show one campaign |
PATCH |
/admin/promotions/{promotionId} |
Super admin | Update a campaign |
DELETE |
/admin/promotions/{promotionId} |
Super admin | Delete a campaign |
GET |
/admin/promotions/{promotionId}/grants |
Super admin | List who received it |
POST |
/admin/promotions/{promotionId}/grants |
Super admin | Hand a manual campaign to one person |
index, show, store and update present each campaign the same way:
{
"id": 1,
"name": "Bienvenida",
"description": null,
"audience": "CLIENT",
"trigger_type": "DELIVERY",
"credit_scope": "SURPLUS",
"milestone_orders": 2,
"milestone_basis": "LIFETIME",
"qualifying_order_kind": "ANY",
"min_order_amount_usd": null,
"reward_type": "FLAT",
"reward_percent": null,
"amount_usd": 10,
"max_amount_usd": null,
"city_id": null,
"starts_at": null,
"ends_at": null,
"max_grants": null,
"grants_count": 0,
"granted_amount_usd": 0,
"active": true,
"is_running": true,
"created_at": "2026-08-27T12:00:00+00:00"
}
| Field | Type | Description |
|---|---|---|
audience |
string | CLIENT or DRIVER |
trigger_type |
string | DELIVERY (granted on a qualifying delivery) or MANUAL (granted by an admin through POST …/grants) |
credit_scope |
string|null | Where the granted credit can be spent: ANY, ORDERS or SURPLUS. Always null for DRIVER |
milestone_orders |
integer|null | Qualifying deliveries that trigger the grant. Always null when trigger_type is MANUAL |
milestone_basis |
string | Which deliveries the milestone counts: LIFETIME (the party's all-time deliveries) or CAMPAIGN (only those made since the campaign opened) |
qualifying_order_kind |
string | Which deliveries count: ANY, REGULAR (orders with no surplus listing) or SURPLUS (surplus reservations) |
min_order_amount_usd |
number|null | Deliveries below this amount do not count. Measured against what the client paid on a CLIENT campaign and what the driver earned on a DRIVER one. null is no minimum |
reward_type |
string | FLAT (a fixed amount_usd) or PERCENT (reward_percent of the order, capped at max_amount_usd) |
reward_percent |
number|null | Percentage granted, 0.01–100. Non-null only when reward_type is PERCENT |
amount_usd |
number|null | Fixed amount granted. Non-null only when reward_type is FLAT |
max_amount_usd |
number|null | Cap on a percentage reward. Non-null only when reward_type is PERCENT |
city_id |
integer|null | Restricts the campaign to one city; null is platform-wide |
starts_at / ends_at |
string|null | ISO-8601 campaign window; null is open-ended |
max_grants |
integer|null | Beneficiary cap; null is uncapped |
grants_count |
integer | How many people already received it |
granted_amount_usd |
number | Total granted so far |
active |
boolean | The admin's on/off switch |
is_running |
boolean | active, inside the window, and under the cap |
Query parameters
| Field | Type | Required | Rules |
|---|---|---|---|
audience |
string | No | CLIENT or DRIVER |
trigger_type |
string | No | DELIVERY or MANUAL |
credit_scope |
string | No | ANY, ORDERS or SURPLUS |
active |
boolean | No | — |
city_id |
integer | No | — |
Response 200 — { "items": [ {promotion}, … ] }, newest first.
Request body
| Field | Type | Required | Rules |
|---|---|---|---|
name |
string | Yes | max:120 |
description |
string|null | No | max:255 |
audience |
string | Yes | CLIENT or DRIVER |
trigger_type |
string | No | DELIVERY or MANUAL. Defaults to DELIVERY |
credit_scope |
string | Conditional | Required when audience is CLIENT; prohibited when DRIVER. ANY, ORDERS or SURPLUS |
milestone_orders |
integer | Conditional | Required when trigger_type is DELIVERY; ignored when MANUAL. min:1, max:1000 |
milestone_basis |
string | No | LIFETIME or CAMPAIGN. Defaults to LIFETIME |
qualifying_order_kind |
string | No | ANY, REGULAR or SURPLUS. Defaults to ANY; forced to ANY when trigger_type is MANUAL |
min_order_amount_usd |
number|null | No | min:0.01, max:100000. Ignored when trigger_type is MANUAL |
reward_type |
string | No | FLAT or PERCENT. Defaults to FLAT |
amount_usd |
number | Conditional | Required when reward_type is FLAT, prohibited when PERCENT. min:0.01, max:10000 |
reward_percent |
number | Conditional | Required when reward_type is PERCENT, prohibited when FLAT. min:0.01, max:100 |
max_amount_usd |
number | Conditional | Required when reward_type is PERCENT, prohibited when FLAT. min:0.01, max:10000 |
city_id |
integer|null | No | Must exist in cities |
starts_at |
date|null | No | — |
ends_at |
date|null | No | after:starts_at |
max_grants |
integer|null | No | min:1 |
active |
boolean | No | Defaults to true |
Response 201 — { "promotion": {promotion} }
Errors
| Status | When |
|---|---|
401 |
Missing or invalid bearer token |
403 |
The admin is not a super admin |
422 |
Validation failed, including a DRIVER campaign carrying credit_scope, a CLIENT campaign missing it, or a MANUAL campaign with reward_type PERCENT |
Response 200 — { "promotion": {promotion} }
Errors
| Status | When |
|---|---|
404 |
PromotionNotFound — no campaign with that id |
Merge-PATCH: only the fields sent are changed. Where a rule below mentions an
effective value, that is the one sent, or the stored one if the field is omitted.
A field the effective shape does not use is set to null on save, so switching a
campaign between shapes does not require sending the unused fields as null.
Request body
| Field | Type | Required | Rules |
|---|---|---|---|
name |
string | No | max:120 |
description |
string|null | No | max:255 |
audience |
string | No | CLIENT or DRIVER |
trigger_type |
string | No | DELIVERY or MANUAL |
credit_scope |
string|null | No | ANY, ORDERS or SURPLUS. Must be null when the effective audience is DRIVER, and non-null when it is CLIENT |
milestone_orders |
integer|null | No | min:1, max:1000. The effective value must be non-null when the effective trigger_type is DELIVERY |
milestone_basis |
string | No | LIFETIME or CAMPAIGN |
qualifying_order_kind |
string | No | ANY, REGULAR or SURPLUS |
min_order_amount_usd |
number|null | No | min:0.01, max:100000 |
reward_type |
string | No | FLAT or PERCENT. Cannot be PERCENT when the effective trigger_type is MANUAL |
amount_usd |
number|null | No | min:0.01, max:10000. The effective value must be non-null when the effective reward_type is FLAT, and may not be sent as non-null when it is PERCENT |
reward_percent |
number|null | No | min:0.01, max:100. The effective value must be non-null when the effective reward_type is PERCENT, and may not be sent as non-null when it is FLAT |
max_amount_usd |
number|null | No | min:0.01, max:10000. Same conditions as reward_percent |
city_id |
integer|null | No | Must exist in cities |
starts_at |
date|null | No | — |
ends_at |
date|null | No | Must be after the effective starts_at |
max_grants |
integer|null | No | min:1 |
active |
boolean | No | — |
Response 200 — { "promotion": {promotion} }
Errors
| Status | When |
|---|---|
404 |
PromotionNotFound — no campaign with that id |
409 |
PromotionAlreadyGranted — grants_count > 0 and the body carries audience, trigger_type, credit_scope, milestone_orders, milestone_basis, qualifying_order_kind, min_order_amount_usd, reward_type, reward_percent, amount_usd or max_amount_usd. The response lists the offending fields |
422 |
Validation failed, including an effective shape that leaves a required field null |
Response 200 — { "deleted": true }
Errors
| Status | When |
|---|---|
404 |
PromotionNotFound — no campaign with that id |
409 |
PromotionHasGrants — grants_count > 0; deactivate it instead |
Cursor-paginated list of who received the campaign, newest first.
Query parameters
| Field | Type | Required | Rules |
|---|---|---|---|
limit |
integer | No | min:1, max:100 (default 25) |
cursor |
string | No | Cursor from a previous response |
Response 200
{
"items": [
{
"id": 8,
"user": { "id": 3, "name": "Ana", "phone": "+58414…" },
"order_id": 91,
"granted_by": null,
"audience": "CLIENT",
"credit_scope": "SURPLUS",
"reward_type": "PERCENT",
"reward_percent": 20,
"base_amount_usd": 20,
"amount_usd": 4,
"created_at": "2026-08-27T12:00:00+00:00"
}
],
"next_cursor": null,
"has_more": false
}
| Field | Type | Description |
|---|---|---|
items[].user |
object | Beneficiary: id, name, phone |
items[].order_id |
integer|null | The delivery that hit the milestone; null on a manual grant |
items[].granted_by |
object|null | The admin who handed it out (id, name); null when the campaign fired on a delivery |
items[].audience |
string | Frozen at grant time |
items[].credit_scope |
string|null | Frozen at grant time |
items[].reward_type |
string | Frozen at grant time: FLAT or PERCENT |
items[].reward_percent |
number|null | Frozen at grant time; null on a flat grant |
items[].base_amount_usd |
number|null | The order amount the percentage was applied to; null on a flat grant |
items[].amount_usd |
number | Frozen at grant time; unaffected by later edits |
Errors
| Status | When |
|---|---|
404 |
PromotionNotFound — no campaign with that id |
422 |
Validation failed |
Hands a MANUAL campaign's bonus to one person.
Request body
| Field | Type | Required | Rules |
|---|---|---|---|
user_id |
integer | Yes | Must exist in users |
Response 201 — { "grant": {grant} }, the same object shape the GET …/grants
items use.
Errors
| Status | When |
|---|---|
404 |
PromotionNotFound — no campaign with that id |
409 |
PromotionNotRunning — the campaign is inactive, outside its window, or at its max_grants cap |
409 |
PromotionAlreadyGrantedToUser — that person already received this campaign |
422 |
PromotionNotManual — trigger_type is not MANUAL |
422 |
UserInactive — the user's account is deactivated |
422 |
UserIsNotDriver — the campaign's audience is DRIVER and the user has no driver profile |
422 |
DriverNotApproved — the campaign's audience is DRIVER and the driver's kyc_state is not APPROVED |
422 |
Validation failed |
curl -X POST /api/v1/admin/promotions \
-H "Authorization: Bearer {superAdminToken}" \
-H "Content-Type: application/json" \
-d '{"name":"Bienvenida","audience":"CLIENT","credit_scope":"ANY","milestone_orders":2,"amount_usd":10}'
curl -X POST /api/v1/admin/promotions \
-H "Authorization: Bearer {superAdminToken}" \
-H "Content-Type: application/json" \
-d '{"name":"5 pedidos","audience":"CLIENT","credit_scope":"ANY","milestone_orders":5,"milestone_basis":"CAMPAIGN","amount_usd":10}'
curl -X POST /api/v1/admin/promotions \
-H "Authorization: Bearer {superAdminToken}" \
-H "Content-Type: application/json" \
-d '{"name":"Primer remate","audience":"DRIVER","milestone_orders":1,"qualifying_order_kind":"SURPLUS","min_order_amount_usd":7.5,"reward_type":"PERCENT","reward_percent":20,"max_amount_usd":10}'
curl -X POST /api/v1/admin/promotions \
-H "Authorization: Bearer {superAdminToken}" \
-H "Content-Type: application/json" \
-d '{"name":"Bono de registro","audience":"DRIVER","trigger_type":"MANUAL","amount_usd":5}'
curl -X POST /api/v1/admin/promotions/1/grants \
-H "Authorization: Bearer {superAdminToken}" \
-H "Content-Type: application/json" \
-d '{"user_id":42}'
curl "/api/v1/admin/promotions?audience=DRIVER&active=true" \
-H "Authorization: Bearer {superAdminToken}"
curl /api/v1/admin/promotions/1/grants -H "Authorization: Bearer {superAdminToken}"