Skip to main content
POST
/
v1
/
campaigns
/
{campaignId}
/
vouchers
/
{code}
Add Voucher with Specific Code to Campaign
curl --request POST \
  --url https://{cluster}.voucherify.io/v1/campaigns/{campaignId}/vouchers/{code} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '{
  "category_id": "cat_0bb81a481615a37b5e",
  "start_date": "2022-09-24T00:00:00Z",
  "expiration_date": "2022-09-25T23:59:59Z",
  "active": false,
  "redemption": {
    "quantity": null
  },
  "additional_info": "Voucher added using API",
  "metadata": {
    "Season": "Fall"
  }
}'
{
  "id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg",
  "code": "Code3",
  "campaign": "Add Voucher to Campaign",
  "campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B",
  "category": null,
  "category_id": "cat_0bb81a481615a37b5e",
  "type": "DISCOUNT_VOUCHER",
  "discount": {
    "type": "PERCENT",
    "amount_limit": 2000,
    "percent_off": 30,
    "effect": "APPLY_TO_ORDER"
  },
  "gift": null,
  "loyalty_card": null,
  "start_date": "2022-09-24T00:00:00.000Z",
  "expiration_date": "2022-09-25T23:59:59.000Z",
  "validity_timeframe": null,
  "validity_day_of_week": [
    1,
    2,
    3,
    4,
    5
  ],
  "active": true,
  "additional_info": "Voucher added using API",
  "metadata": {
    "Season": "Fall"
  },
  "assets": {
    "qr": {
      "id": "U2FsdGVkX1+p2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6+1N81zXuY6/pnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg==",
      "url": "{{internalVoucherifyURL}}"
    },
    "barcode": {
      "id": "U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5/u9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY+sOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW+NCQg6Ts8clYWWP5lrGyV/fzoA==",
      "url": "{{internalVoucherifyURL}}"
    }
  },
  "is_referral_code": false,
  "created_at": "2022-09-21T07:14:28.217Z",
  "updated_at": null,
  "validation_rules_assignments": {
    "object": "list",
    "data_ref": "data",
    "data": [],
    "total": 0
  },
  "redemption": {
    "quantity": null,
    "redeemed_quantity": 0,
    "object": "list",
    "url": "/v1/vouchers/Code3/redemptions?page=1&limit=10"
  },
  "publish": {
    "object": "list",
    "count": 0,
    "url": "/v1/vouchers/Code3/publications?page=1&limit=10"
  },
  "object": "voucher"
}

Authorizations

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

Path Parameters

campaignId
string
required
Example:
code
string
required
Example:

Body

application/json
category
string
metadata
object
redemption
object
additional_info
string
start_date
string<date-time>
Example:
expiration_date
string<date-time>
Example:

Response

id
string
Example:
code
string
Example:
campaign
string
Example:
campaign_id
string
Example:
category
string
category_id
string
Example:
type
enum<string>
Available options:
GIFT_VOUCHER,
DISCOUNT_VOUCHER,
LOYALTY_CARD
discount
object
  • Amount
  • Unit
  • Unit Multiple
  • Percent
  • Fixed
gift
object
loyalty_card
object
start_date
string<date-time>
Example:
expiration_date
string<date-time>
Example:
validity_timeframe
object
validity_day_of_week
enum<integer>[]
validity_hours
object
active
boolean | null
additional_info
string
metadata
object
assets
object
is_referral_code
boolean | null
created_at
string<date-time>
Example:
updated_at
string<date-time>
Example:
holder_id
string
Example:
referrer_id
string
Example:
object
string
default:voucher
publish
object
redemption
object
categories
Category · object[]
validation_rules_assignments
object