Skip to main content
POST
/
v1
/
products
Create Product
curl --request POST \
  --url https://{cluster}.voucherify.io/v1/products \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '{
  "source_id": "first_product",
  "name": "Samsung Phone",
  "price": 200000,
  "attributes": [
    "color",
    "memory",
    "processor"
  ],
  "metadata": {
    "test": true,
    "vendor": "Online Store"
  },
  "image_url": "{{internalVoucherifyURL}}"
}'
{
  "id": "prod_0bae2dc5a090fd0184",
  "source_id": "first_product",
  "name": "Samsung Phone",
  "price": 200000,
  "attributes": [
    "color",
    "memory",
    "processor"
  ],
  "metadata": {
    "test": true,
    "vendor": "Online Store"
  },
  "image_url": "https://www.website.com/image.png",
  "created_at": "2022-09-12T12:58:22.232Z",
  "updated_at": "2022-09-12T12:59:55.890Z",
  "object": "product"
}

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.

Body

application/json

Specify the product parameters.

Request schema for POST v1/products.

id
string

A unique identifier that represents the product and is assigned by Voucherify.

Example:

"prod_5h0wc453_1"

source_id
string

Unique product source ID.

Example:

"productSourceID16"

name
string

Unique user-defined product name.

Example:

"T-shirt"

price
integer

Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as $100.00 being expressed as 10000.

attributes
string[]

A list of product attributes whose values you can customize for given SKUs: ["color","size","ranking"]. Each child SKU can have a unique value for a given attribute.

metadata
object

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

image_url
string

The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.

Example:

"https://images.com/original.jpg"

Response

200 - application/json

Returns a product object if the operation succeeded.

Response body schema for POST v1/products. This is an object representing a product.

This entity should be used to map product items from your inventory management system. The aim of products is to build which reflect product-specific campaigns.

id
string
required

Unique product ID assigned by Voucherify.

Example:

"prod_0b1da8105693710357"

source_id
string | null
required

Unique product source ID.

Example:

"productSourceID16"

name
string | null
required

Unique user-defined product name.

Example:

"T-shirt"

price
integer | null
required

Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as $100.00 being expressed as 10000.

attributes
string[]
required

A list of product attributes whose values you can customize for given SKUs: ["color","size","ranking"]. Each child SKU can have a unique value for a given attribute.

metadata
object
required

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

object
enum<string>
default:product
required

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

Available options:
product
skus
object

Contains information about child SKUs.

image_url
string | null

The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.

Example:

"https://images.com/original.jpg"

created_at
string<date-time>

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

Example:

"2022-05-23T06:52:55.008Z"

updated_at
string<date-time> | null

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

Example:

"2022-05-23T09:24:07.405Z"

I