Get campaign barcode conflicts
Detect barcodes assigned to campaigns with overlapping date windows
Contents
- Overview
- Permissions and authentication
- HTTP parameters
- Headers
- Sample request & response
- Possible error responses
Overview
- Call name: get-campaign-barcode-conflicts
- Endpoint URL: https://{API hostname}/internal/get-campaign-barcode-conflicts
- Request methods: GET
- Response Content-Type: application/json
- Auth required: yes
The get-campaign-barcode-conflicts endpoint checks whether any of the supplied barcodes are already assigned to one or more campaigns whose active date windows overlap a given reference window, within a chain.
For each requested barcode, the response lists the campaigns that hold it and whose schedule overlaps the reference window. A barcode appears in the response only when at least one such campaign exists. This allows API consumers to detect barcode/schedule clashes in a single request, rather than fetching all campaigns via get-campaigns and comparing them client-side.
The reference window is supplied via active_date_from and active_date_until. Two date windows overlap when each starts on or before the other ends. An omitted bound is treated as open-ended: omitting active_date_from extends the window infinitely into the past, and omitting active_date_until extends it infinitely into the future. Overlap is inclusive at the boundary.
A campaign's enabled/disabled flag is not considered — only date-window overlap matters. Deleted campaigns are never returned. Use exclude_campaign_id to omit a specific campaign from the results (for example, to prevent a campaign from being reported as conflicting with itself when checking its own barcodes).
Permissions and authentication
This API call requires a valid Spaaza session. The session can be as follows:
- Admin authentication: the performing user needs to be logged in and have
read accessto the chain whose campaigns are checked.
HTTP parameters
The following HTTP parameters can be passed to the API:
| Parameter | Description |
|---|---|
| chain_id | (integer, mandatory) The ID of the chain whose campaigns are checked. |
| barcodes | (string, mandatory) A comma-separated list of one or more barcodes to check. Duplicates and surrounding whitespace are ignored. A maximum of 1000 barcodes may be supplied per request. |
| active_date_from | (datetime, optional) Start of the reference date window. When omitted, the reference window is open-ended in the past. Must be a parseable datetime string (e.g. 2026-01-01T00:00:00+00:00). |
| active_date_until | (datetime, optional) End of the reference date window. When omitted, the reference window is open-ended in the future. Must be a parseable datetime string (e.g. 2026-12-31T23:59:59+00:00). |
| exclude_campaign_id | (integer, optional) A campaign ID to exclude from the results. Useful when checking barcodes for an existing campaign so that it is not reported as conflicting with itself. Omit when checking barcodes for a campaign that does not yet exist. |
Headers
The following headers can/must be passed to the API call:
| Parameter | Description |
|---|---|
| N/A | N/A |
Sample request & response
Request
Example curl request:
curl --location 'https://{API hostname}/internal/get-campaign-barcode-conflicts?chain_id=1743&barcodes=6001069601744,8711000535806&active_date_from=2026-01-01T00:00:00%2B00:00&active_date_until=2026-12-31T23:59:59%2B00:00&exclude_campaign_id=1234' \
--header 'X-Spaaza-Session-User-Id: 1548854' \
--header 'X-Spaaza-Session-Key: 564e5b4faa7f639dacf1983f1dae62155d5734b789b06b5986c43bfe2542854e'
Response
Example response:
{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"conflicts": [
{
"barcode": "6001069601744",
"campaigns": [
{
"active": true,
"active_date_from": "2026-04-10T18:00:00+00:00",
"active_date_until": "2026-12-31T22:59:00+00:00",
"campaign_id": 4343,
"name": "Summer Rewards Campaign",
"types": [
"earn"
]
},
{
"active": true,
"active_date_from": "2026-06-08T22:00:00+00:00",
"active_date_until": "2026-08-30T22:00:00+00:00",
"campaign_id": 5701,
"name": "Product Discount Promotion",
"types": [
"spend"
]
}
]
},
{
"barcode": "8711000535806",
"campaigns": [
{
"active": true,
"active_date_from": "2026-06-09T06:00:00+00:00",
"active_date_until": "2026-06-30T15:00:00+00:00",
"campaign_id": 5698,
"name": "Buy One Get One Free",
"types": [
"spend",
"earn"
]
}
]
}
],
"total_count": 2,
"result_type": "get-campaign-barcode-conflicts"
}
}
The conflicts array contains one entry per barcode that has at least one overlapping campaign (after exclusion). Each entry includes:
| Field | Description |
|---|---|
| barcode | The barcode string that has conflicts. |
| campaigns | An array of campaigns assigned to this barcode whose date window overlaps the reference window. Each campaign object contains the fields described below. |
Each campaign object within campaigns contains:
| Field | Description |
|---|---|
| campaign_id | The unique ID of the campaign. |
| name | The title of the campaign. |
| active | Whether the campaign is currently enabled (true or false). Note: the enabled flag does not affect overlap detection. |
| active_date_from | The start of the campaign's active date window (ISO-8601 format), or null if open-ended. |
| active_date_until | The end of the campaign's active date window (ISO-8601 format), or null if open-ended. |
| types | An array of assignment types by which this campaign holds the barcode. Possible values are "earn" and "spend". |
The total_count field is the number of barcodes with conflicts (i.e. the length of the conflicts array).
Barcodes that have no overlapping campaigns, or whose only overlapping campaign is the excluded one, are not included in the response.
Possible error responses
| Code | Name and Description | HTTP Status Code |
|---|---|---|
| 6 | no_valid_session The user needs to be logged in and a valid session key needs to be sent. | 401 |
| 68 | permission_denied_or_non_existent This user has insufficient permissions for this object or the object does not exist. | 403 |
| 217 | chain_id_not_found No record has been found for that chain_id. | 400 |
| 419 | parameter_invalid One of the parameters is invalid and should be in a different format. | 400 |