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
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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.
offsetnumberOptional
The number of items to skip when retrieving a list.
limitnumberOptional
Limit the number of items returned in the list.
orderstringOptional
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
with_deletedbooleanOptional
Whether to include deleted records in the result.
qstringOptional
Apply a search query to the campaign's searchable properties.
campaign_identifierstringOptional
Filter by a campaign identifier.
budgetobjectOptional
Filter by the campaign's budget.
$andobject[]Optional
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
$orobject[]Optional
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.

Request examples

Responses

200 OK

limitnumber
The maximum number of items retrieved.
offsetnumber
The number of its skipped before the returned items.
countnumber
The total number of items.
campaignsobject[]
The list of campaigns.

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
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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)

namestring
The campaign's name.
campaign_identifierstring
The campaign's identifier.
descriptionstring
The campaign's description.
budgetobject
The campaign's budget which, when crossed, ends the campaign.
starts_atstring
The campaign's start date.
ends_atstring
The campaign's end date.
promotionsobject[]Optional
The campaign's promotions.
additional_dataobjectOptional
Pass additional custom data to the API route. This data is passed to the underlying workflow under the additional_data parameter.

Request examples

Responses

200 OK

campaignobject
The campaign's details.

400, 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

idstring
The campaign's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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

campaignobject
The campaign's details.

400, 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

idstring
The campaign's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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)

namestringOptional
The campaign's name.
campaign_identifierstringOptional
The campaign's identifier.
descriptionstring
The campaign's description.
budgetobjectOptional
The campaign's budget.
starts_atstring
The campaign's start date.
ends_atstring
The campaign's end date.
promotionsobject[]Optional
The campaign's promotions.
additional_dataobjectOptional
Pass additional custom data to the API route. This data is passed to the underlying workflow under the additional_data parameter.

Request examples

Responses

200 OK

campaignobject
The campaign's details.

400, 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

idstring
The campaign's ID.

Request examples

Responses

200 OK

idstring
The campaign's ID.
objectstring
The name of the object that was deleted.

Default: "campaign"

deletedboolean
Whether the campaign was deleted.

400, 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

idstring
The campaign's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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[]Optional
The IDs of an entity to add to the other.
removestring[]Optional
The IDs of an entity to remove from the other.

Request examples

Responses

200 OK

campaignobject
The campaign's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page