Loyalties
Create Loyalty Campaign
Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern.
📘 Global uniqueness All codes are unique across the whole project. Voucherify won't allow to generate the same codes in any of your campaigns.
🚧 Asynchronous action!
This is an asynchronous action, you can't read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description.
post/v1/loyalties
Request body
Example request
{
"start_date": "2022-09-20T00:00:00.000Z",
"expiration_date": "2022-09-30T00:00:00.000Z",
"validity_timeframe": {
"duration": "PT1H",
"interval": "P2D"
},
"validity_hours": {
"daily": [
{
"start_time": "12:00",
"expiration_time": "14:00"
}
]
},
"category_id": "cat_0b688929a2476386a7"
}Response
Returns a campaign object with its settings but without the loyalty card codes.
Example response
{
"id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA",
"voucher": {
"start_date": "2022-09-20T00:00:00.000Z",
"expiration_date": "2022-09-30T00:00:00.000Z",
"validity_timeframe": {
"duration": "PT1H",
"interval": "P2D"
},
"validity_hours": {
"daily": [
{
"start_time": "12:00",
"expiration_time": "14:00"
}
]
}
},
"validity_timeframe": {
"duration": "PT1H",
"interval": "P2D"
},
"validity_hours": {
"daily": [
{
"start_time": "12:00",
"expiration_time": "14:00"
}
]
},
"start_date": "2022-09-20T00:00:00.000Z",
"expiration_date": "2022-09-30T00:00:00.000Z",
"created_at": "2021-12-01T08:00:50.038Z",
"updated_at": "2022-09-20T09:18:19.623Z",
"category_id": "cat_0b688929a2476386a7",
"categories": [
{
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z"
}
],
"validation_rules_assignments": {
"data": [
{
"id": "asgm_LnY1g7UNFA9KyDrD",
"rule_id": "val_3gPNA6SnH4ae",
"related_object_id": "camp_CZOnEGiZfwIKWmSjhIoIT7Ol",
"related_object_type": "campaign",
"object": "validation_rules_assignment",
"validation_status": "PARTIALLY_VALID",
"validation_omitted_rules": [
"1"
]
}
]
},
"access_settings_assignments": {
"data": [
{
"id": "arsca_0ef5ee192117ae2416",
"area_id": "ar_0ea6cd7b781b8f857f",
"area_store_id": "ars_0ec347e2016bed85f4",
"created_at": "2024-06-25T19:04:16.260Z"
}
]
}
}