curl --request POST \
--url https://{cluster}.voucherify.io/v1/publications \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"campaign": {
"name": "campaign-name"
},
"customer": {
"source_id": "source-id",
"Name": "Customer Name",
"email": "customer email"
},
"voucher": "voucher-code",
"metadata": {
"key": "value"
}
}
'{
"id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh",
"object": "publication",
"created_at": "2022-09-30T16:30:32.924Z",
"customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS",
"tracking_id": "pub_source_customer_5",
"metadata": {
"year": 2022
},
"channel": "myown",
"source_id": "publication_source_ID_10",
"result": "SUCCESS",
"customer": {
"id": "cust_BB6F97yf0XqCe7hxVUV7M4sS",
"name": "Bob Jones",
"email": "bob.smith@email.com",
"source_id": "pub_source_customer_5",
"metadata": {
"lang": "en",
"test": true
},
"object": "customer"
},
"voucher": {
"id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf",
"code": "cEsMn0uA",
"campaign": "Test - Discount Effect - Amount - Items",
"campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l",
"category": null,
"category_id": null,
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 300,
"effect": "APPLY_TO_ITEMS"
},
"gift": null,
"loyalty_card": null,
"start_date": null,
"expiration_date": null,
"validity_timeframe": null,
"validity_day_of_week": null,
"active": true,
"additional_info": null,
"metadata": {},
"assets": {
"qr": {
"id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==",
"url": "{{internalVoucherifyURL}}"
},
"barcode": {
"id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==",
"url": "{{internalVoucherifyURL}}"
}
},
"is_referral_code": false,
"created_at": "2022-09-30T16:30:32.956Z",
"updated_at": null,
"holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS",
"redemption": {
"quantity": 1,
"redeemed_quantity": 0,
"object": "list",
"url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10"
},
"publish": {
"object": "list",
"count": 1,
"url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10"
},
"object": "voucher"
},
"vouchers_id": [
"v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf"
]
}Create Publication
This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.
A voucher is suitable for publication when it’s active and hasn’t been published yet.
You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code.
In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish.
In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an auto-update campaign.
curl --request POST \
--url https://{cluster}.voucherify.io/v1/publications \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"campaign": {
"name": "campaign-name"
},
"customer": {
"source_id": "source-id",
"Name": "Customer Name",
"email": "customer email"
},
"voucher": "voucher-code",
"metadata": {
"key": "value"
}
}
'{
"id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh",
"object": "publication",
"created_at": "2022-09-30T16:30:32.924Z",
"customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS",
"tracking_id": "pub_source_customer_5",
"metadata": {
"year": 2022
},
"channel": "myown",
"source_id": "publication_source_ID_10",
"result": "SUCCESS",
"customer": {
"id": "cust_BB6F97yf0XqCe7hxVUV7M4sS",
"name": "Bob Jones",
"email": "bob.smith@email.com",
"source_id": "pub_source_customer_5",
"metadata": {
"lang": "en",
"test": true
},
"object": "customer"
},
"voucher": {
"id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf",
"code": "cEsMn0uA",
"campaign": "Test - Discount Effect - Amount - Items",
"campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l",
"category": null,
"category_id": null,
"type": "DISCOUNT_VOUCHER",
"discount": {
"type": "AMOUNT",
"amount_off": 300,
"effect": "APPLY_TO_ITEMS"
},
"gift": null,
"loyalty_card": null,
"start_date": null,
"expiration_date": null,
"validity_timeframe": null,
"validity_day_of_week": null,
"active": true,
"additional_info": null,
"metadata": {},
"assets": {
"qr": {
"id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==",
"url": "{{internalVoucherifyURL}}"
},
"barcode": {
"id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==",
"url": "{{internalVoucherifyURL}}"
}
},
"is_referral_code": false,
"created_at": "2022-09-30T16:30:32.956Z",
"updated_at": null,
"holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS",
"redemption": {
"quantity": 1,
"redeemed_quantity": 0,
"object": "list",
"url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10"
},
"publish": {
"object": "list",
"count": 1,
"url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10"
},
"object": "voucher"
},
"vouchers_id": [
"v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf"
]
}Authorizations
Scopes
Query Parameters
Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.
Body
Specify the publication parameters.
- Create Publication With Specific Voucher
- Create Publication With Campaign
Create publication with specific voucher.
The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service.
If source_id is provided only 1 voucher can be published per request.
Response
Returns a publication object if a valid identifier was provided.
- Publications Create Voucher Response Body
- Publications Create Vouchers Response Body
Response body schema for POST v1/publication and GET v1/publications/create.
The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service.

