Skip to main content
POST
/
management
/
v1
/
projects
/
{projectId}
/
metadata-schemas
Create Metadata Schema
curl --request POST \
  --url https://{cluster}.voucherify.io/management/v1/projects/{projectId}/metadata-schemas \
  --header 'Content-Type: application/json' \
  --header 'X-Management-Id: <api-key>' \
  --header 'X-Management-Token: <api-key>' \
  --data '{
  "related_object": "<string>",
  "allow_defined_only": false,
  "properties": {}
}'
{
  "id": "ms_u3bIQLbdU0fi3rhqpTLiF26T",
  "related_object": "reward",
  "properties": {
    "region": {
      "type": "string",
      "array": true,
      "optional": false,
      "object_type": null,
      "eq": [
        "EMEA",
        "APAC",
        "LATAM",
        "NA"
      ]
    }
  },
  "allow_defined_only": null,
  "created_at": "2024-04-29T12:03:55.991Z",
  "updated_at": null,
  "object": "metadata_schema"
}

Authorizations

X-Management-Id
string
header
required
X-Management-Token
string
header
required

Path Parameters

projectId
string
required

Provide the unique identifier of the project.

Example:

"proj_TrlkLiH4"

Body

application/json

Defines the metadata schema.

The resource type. You can define custom metadata schemas, which have a custom "related_object" resource type, or you can use standard resource types: "campaign", "customer", "earning_rule", "loyalty_tier", "order", "order_item", "product", "promotion_tier", "publication", "redemption", "reward", "voucher".

properties
object
required

Contains metadata definitions. There can be many properties within this object.

Only the properties sent in the request will be created.

allow_defined_only
boolean
default:false

Restricts the creation of metadata fields when set to true. In other words, it indicates whether or not you are allowed to create new metadata definitions; for example, in the campaign manager or publication manager. If it is set to true, then only the defined fields will be available for assigning values.

Response

Returns the details about the metadata schema.

Response body schema for POST management/v1/projects/{projectId}/metadata-schemas. Object representing a metadata schema.

id
string
required

Unique identifier of the metadata schema.

The resource type. You can define custom metadata schemas, which have a custom "related_object" resource type. The standard metadata schemas are: "campaign", "customer", "earning_rule", "loyalty_tier", "order", "order_item", "product", "promotion_tier", "publication", "redemption", "reward", "voucher".

properties
object
required

Contains metadata definitions.

allow_defined_only
boolean | null
required

Restricts the creation of metadata fields when set to true. It indicates whether or not you can create new metadata definitions, e.g. in the campaign or publication manager. If set to true, then only the defined fields are available for assigning values.

created_at
string<date-time>
required

Timestamp representing the date and time when the metadata schema was created. The value for this parameter is shown in the ISO 8601 format.

Example:

"2021-12-03T13:33:44.556Z"

updated_at
string<date-time> | null
required

Timestamp representing the date and time when the metadata schema was updated. The value for this parameter is shown in the ISO 8601 format.

Example:

"2022-08-11T08:05:30.695Z"

object
string
default:metadata_schema
required

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

I