Skip to main content
POST
/
v1
/
publications
curl --request POST \ --url https://{cluster}.voucherify.io/v1/publications \ --header 'Authorization: Bearer <token>' \ --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

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Query Parameters

join_once
boolean

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

application/json

Specify the publication parameters.

Create publication with specific voucher.

voucher
string
required

Code of the voucher being published.

customer
Customer · object
required

Contains information about the customer to whom the publication was directed.

source_id
string

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.

metadata
object

The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.

channel
string

Specify the distribution channel.

Response

Returns a publication object if a valid identifier was provided.

Response body schema for POST v1/publication and GET v1/publications/create.

id
string
required

Unique publication ID, assigned by Voucherify.

Example:

"pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp"

object
enum<string>
default:publication
required

The type of the object represented by the JSON. This object stores information about the publication.

Available options:
publication
created_at
string<date-time>
required

Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format.

Example:

"2022-09-23T09:57:00.434Z"

customer_id
string
required

Unique customer ID of the customer receiving the publication.

Example:

"cust_eWgXlBBiY6THFRJwX45Iakv4"

metadata
object
required

The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.

channel
enum<string>
default:API
required

How the publication was originated. It can be your own custom channel or an example value provided here.

Available options:
API
source_id
string | null
required

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.

result
enum<string>
default:SUCCESS
required

Status of the publication attempt.

Available options:
SUCCESS
customer
Customer With Summary Loyalty Referrals · object
required
vouchers_id
string[]
required

Contains the unique internal voucher ID that was assigned by Voucherify.

voucher
Voucher · object
required

This is an object representing a voucher with categories and validation rules assignments.

tracking_id
string

Customer's source_id.