Campaigns API Routes
A campaign is a group of promotions that have the same conditions, such as start and end dates.
These API routes allow admin users to manage campaigns, their conditions, and promotions that belong to them.
GET /admin/campaigns#
List Campaigns
Retrieve a list of campaigns. The campaigns can be filtered by fields such as id. The campaigns can also be sorted or paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.offsetnumberOptionallimitnumberOptionalorderstringOptional-.with_deletedbooleanOptionalqstringOptionalcampaign_identifierstringOptionalbudgetobjectOptionalFilter by the campaign's budget.
budgetobjectOptional$andobject[]Optional$orobject[]OptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumbercampaignsobject[]The list of campaigns.
campaignsobject[]400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/campaigns#
Create Campaign
Create a campaign.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.Request body (application/json)
namestringcampaign_identifierstringdescriptionstringbudgetobjectThe campaign's budget which, when crossed, ends the campaign.
budgetobjectstarts_atstringends_atstringpromotionsobject[]OptionalThe campaign's promotions.
promotionsobject[]Optionaladditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
campaignobjectThe campaign's details.
campaignobject400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/campaigns/{id}#
Get a Campaign
Retrieve a campaign by its ID. You can expand the campaign's relations or select the fields that should be returned using the query parameters.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.Request examples
Responses
200 OK
campaignobjectThe campaign's details.
campaignobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/campaigns/{id}#
Update a Campaign
Update a campaign's details.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.Request body (application/json)
namestringOptionalcampaign_identifierstringOptionaldescriptionstringbudgetobjectOptionalThe campaign's budget.
budgetobjectOptionalstarts_atstringends_atstringpromotionsobject[]OptionalThe campaign's promotions.
promotionsobject[]Optionaladditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
campaignobjectThe campaign's details.
campaignobject400, 401, 404, 409, 422, 500: an error response is returned.
DELETE /admin/campaigns/{id}#
Delete a Campaign
Delete a campaign by its ID. This doesn't delete promotions that belong to this campaign.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest examples
Responses
200 OK
idstringobjectstringDefault: "campaign"
deletedboolean400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/campaigns/{id}/promotions#
Manage the Promotions of a Campaign
Manage the promotions of a campaign, either by adding them or removing them from the campaign.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.Request body (application/json)
addstring[]Optionalremovestring[]OptionalRequest examples
Responses
200 OK
campaignobjectThe campaign's details.
campaignobject400, 401, 404, 409, 422, 500: an error response is returned.