> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voucherify.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Metadata Schema

> Retrieves a metadata schema per resource type.

## Resource types

### Standard

You can retrieve metadata schemas for the standard metadata schema definitions listed below. Add one of these types as the resource path parameter.

- `campaign`
- `customer`
- `earning_rule`
- `loyalty_tier`
- `order`
- `order_item`
- `product`
- `promotion_tier`
- `publication`
- `redemption`
- `reward`
- `voucher`

### Custom

If you have defined a [custom metadata schema](/prepare/metadata#add-metadata), provide its name in the `"resource"` field to retrieve its details.

>📘 Management API
>
>If you have Management API enabled, you can also use the [Get Metadata Schemas](/api-reference/management/get-metadata-schema) endpoint to retrieve a metadata schema using its ID.



## OpenAPI

````yaml /openapi/metadata-schemas.json get /v1/metadata-schemas/{resource}
openapi: 3.0.1
info:
  title: Voucherify API - Metadata Schemas
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /v1/metadata-schemas/{resource}:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterString'
        name: resource
        in: path
        required: true
        description: >-
          There is an infinite number of possibilities for retrieving metadata
          schemas by the resource type because you can define custom metadata
          schemas.
    get:
      tags:
        - Metadata Schemas
      summary: Get Metadata Schema
      description: >-
        Retrieves a metadata schema per resource type.


        ## Resource types


        ### Standard


        You can retrieve metadata schemas for the standard metadata schema
        definitions listed below. Add one of these types as the resource path
        parameter.


        - `campaign`

        - `customer`

        - `earning_rule`

        - `loyalty_tier`

        - `order`

        - `order_item`

        - `product`

        - `promotion_tier`

        - `publication`

        - `redemption`

        - `reward`

        - `voucher`


        ### Custom


        If you have defined a [custom metadata
        schema](/prepare/metadata#add-metadata), provide its name in the
        `"resource"` field to retrieve its details.


        >📘 Management API

        >

        >If you have Management API enabled, you can also use the [Get Metadata
        Schemas](/api-reference/management/get-metadata-schema) endpoint to
        retrieve a metadata schema using its ID.
      operationId: get-metadata-schema
      parameters: []
      responses:
        '200':
          description: >-
            The response does not include unknown metadata properties in the
            response, i.e. those that have been defined outside of the **Project
            Settings** > **Metadata Schema** definitions. For example, an
            unknown metadata property can be defined in the campaign manager.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataSchemasGetResponseBody'
              examples:
                earning_rule:
                  value:
                    id: ms_27vMXZqBAkkqBoOuw8EYTRLn
                    related_object: earning_rule
                    properties:
                      channel_id:
                        type: string
                        array: true
                        optional: true
                        objectType: null
                        exactLength: 5
                      channel_name:
                        eq:
                          - instagram
                          - facebook
                          - google
                          - twitter
                          - linkedin
                          - website
                        type: string
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2022-08-25T13:09:59.970Z'
                    updated_at: '2022-08-25T13:11:15.704Z'
                    object: metadata_schema
                campaign:
                  value:
                    id: ms_psGSDpVl6JcPilPA7toZ83Kj
                    related_object: campaign
                    properties:
                      region:
                        eq:
                          - EMEA
                          - AMER
                          - APAC
                        type: string
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2022-08-25T13:12:58.447Z'
                    updated_at: '2022-08-25T13:16:03.167Z'
                    object: metadata_schema
                customer:
                  value:
                    id: ms_f0r4hm3ta6a4a5ch3ma
                    related_object: customer
                    properties:
                      age:
                        type: number
                        array: false
                        optional: true
                        objectType: null
                      city_id:
                        type: number
                        array: false
                        optional: true
                        objectType: null
                      location:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      favorite_brands:
                        type: string
                        array: true
                        optional: true
                        objectType: null
                      acquisition_channel:
                        eq:
                          - Facebook
                          - Twitter
                          - Website
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      customer_life_time_value:
                        type: number
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2021-12-01T08:00:48.889Z'
                    updated_at: '2022-09-12T07:34:49.163Z'
                    object: metadata_schema
                loyalty_tier:
                  value:
                    id: ms_jHUoFlgepKVEftxK1pKPGZlO
                    related_object: loyalty_tier
                    properties:
                      level_name:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      audience_restricted:
                        type: boolean
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2022-08-25T13:14:54.954Z'
                    updated_at: '2022-08-25T13:15:24.436Z'
                    object: metadata_schema
                order:
                  value:
                    id: ms_f1r5Tm3ta6a4a5ch3ma
                    related_object: order
                    properties:
                      card:
                        eq:
                          - Visa
                          - MasterCard
                          - Other
                        type: string
                        array: true
                        optional: true
                        objectType: null
                      currency:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      location:
                        ne:
                          - 1
                          - 2
                          - 18
                          - 22
                        type: number
                        array: false
                        optional: true
                        objectType: null
                      store_city:
                        eq:
                          - Hampden
                          - San Francisco
                          - Warsaw
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      location_id:
                        eq:
                          - L1
                          - L2
                          - L3
                        type: string
                        array: true
                        optional: true
                        objectType: null
                      payment_mean:
                        eq:
                          - credit-card
                          - wire-transfer
                          - paypal
                        type: string
                        array: true
                        optional: true
                        objectType: null
                      booking_end_date:
                        type: datetime
                        array: false
                        optional: true
                        objectType: null
                      booking_start_date:
                        type: datetime
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2021-12-01T08:00:47.575Z'
                    updated_at: '2022-10-25T10:05:18.978Z'
                    object: metadata_schema
                order_item:
                  value:
                    id: ms_7ux44AEnt82bqo8ww5V1SXzV
                    related_object: order_item
                    properties:
                      manufacturer_id:
                        gte: 15
                        type: number
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2022-08-25T13:16:03.167Z'
                    updated_at: '2022-08-25T13:16:03.167Z'
                    object: metadata_schema
                product:
                  value:
                    id: ms_s3c0N6m3ta6a4a5ch3ma
                    related_object: product
                    properties:
                      vendor:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      category:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      location:
                        type: geopoint
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2021-12-01T08:00:48.298Z'
                    updated_at: '2022-07-14T15:53:29.226Z'
                    object: metadata_schema
                promotion_tier:
                  value:
                    id: ms_dNb5aLMzU0VBCiRuxLOeMNwn
                    related_object: promotion_tier
                    properties:
                      level:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2022-01-24T10:42:04.937Z'
                    updated_at: '2022-09-23T08:51:46.266Z'
                    object: metadata_schema
                publication:
                  value:
                    id: ms_fzvWNh7sU4LeykEQ2Abpg6jG
                    related_object: publication
                    properties:
                      file_uploaded:
                        type: image_url
                        array: false
                        optional: true
                        objectType: null
                      publication_method:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2022-08-25T13:16:35.534Z'
                    updated_at: '2022-09-12T10:26:31.135Z'
                    object: metadata_schema
                redemption:
                  value:
                    id: ms_t4ir0Dm3ta6a4a5ch3ma
                    related_object: redemption
                    properties:
                      location_id:
                        eq:
                          - L1
                          - L2
                          - L3
                        type: string
                        array: true
                        optional: true
                        objectType: null
                      redemption_location:
                        type: object
                        array: false
                        optional: true
                        objectType: Location
                    allow_defined_only: false
                    created_at: '2021-12-01T08:00:48.794Z'
                    updated_at: '2022-08-25T13:19:50.497Z'
                    object: metadata_schema
                reward:
                  value:
                    id: ms_PwrAtwqCFXeH4Qix22gEkqhl
                    related_object: reward
                    properties:
                      reward_type:
                        eq:
                          - MATERIAL
                          - PAY-WITH-POINTS
                          - DISCOUNT-COUPON
                          - GIFT-CARD-CREDITS
                          - LOYALTY POINTS
                        type: string
                        array: false
                        optional: false
                        objectType: null
                    allow_defined_only: true
                    created_at: '2022-08-25T13:07:13.689Z'
                    updated_at: '2022-08-25T13:08:26.696Z'
                    object: metadata_schema
                voucher:
                  value:
                    id: ms_9uE6eP17Jvoxl46mCqL6Q3Ut
                    related_object: voucher
                    properties:
                      lang:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      Season:
                        eq:
                          - Spring
                          - Summer
                          - Fall
                          - Winter
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      marketing_text:
                        type: string
                        array: false
                        optional: true
                        objectType: null
                      ProductionVoucherCodeMetaData:
                        type: string
                        array: false
                        deleted: true
                        optional: true
                        objectType: null
                    allow_defined_only: false
                    created_at: '2022-01-24T10:42:23.994Z'
                    updated_at: '2022-09-19T14:13:30.590Z'
                    object: metadata_schema
        '404':
          description: Returns an error if the resource provided in the path is not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Not Found:
                  value:
                    code: 404
                    key: not_found
                    message: Resource not found
                    details: Cannot find metadata schema with id earning_rules
                    request_id: v-0c1b9ce0098a391421
                    resource_id: earning_rules
                    resource_type: metadata schema
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - metadata-schemas
components:
  schemas:
    ParameterString:
      type: string
    MetadataSchemasGetResponseBody:
      type: object
      title: Metadata Schemas Get Response Body
      description: Response body schema for **GET** `/v1/metadata-schemas/{resource}`.
      allOf:
        - $ref: '#/components/schemas/MetadataSchemaDeprecated'
    Error:
      title: Error Object
      type: object
      description: Error details
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a885062c80375740f
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
        resource_id:
          type: string
          description: >-
            Unique resource ID that can be used in another endpoint to get more
            details.
          example: rf_0c5d710a87c8a31f86
        resource_type:
          type: string
          description: The resource type.
          example: voucher
        error:
          type: object
          description: Includes additional information about the error.
          properties:
            message:
              type: string
              description: The message configured by the user in a validation rule.
      required:
        - code
        - message
    MetadataSchemaDeprecated:
      type: object
      description: Object representing a metadata schema.
      allOf:
        - type: object
          properties:
            id:
              type: string
              description: Unique identifier of the metadata schema.
            related_object:
              type: string
              description: >-
                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"`.
        - type: object
          properties:
            properties:
              type: object
              description: Contains metadata definitions.
              additionalProperties:
                $ref: '#/components/schemas/MetadataSchemaDefinitionDeprecated'
          required:
            - properties
        - type: object
          properties:
            allow_defined_only:
              type: boolean
              nullable: true
              description: >-
                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:
              type: string
              example: '2021-12-03T13:33:44.556Z'
              description: >-
                Timestamp representing the date and time when the metadata
                schema was created. The value for this parameter is shown in the
                ISO 8601 format.
              format: date-time
            updated_at:
              type: string
              nullable: true
              example: '2022-08-11T08:05:30.695Z'
              description: >-
                Timestamp representing the date and time when the metadata
                schema was updated. The value for this parameter is shown in the
                ISO 8601 format.
              format: date-time
            object:
              type: string
              default: metadata_schema
              description: >-
                The type of the object represented by the JSON. This object
                stores information about the metadata schema.
      required:
        - id
        - related_object
        - properties
        - allow_defined_only
        - created_at
        - updated_at
        - object
    MetadataSchemaDefinitionDeprecated:
      type: object
      title: Metadata Definitions
      description: >-
        Custom definition name. This is also shown in **Project Settings** >
        **Metadata Schema** in the Voucherify Dashboard.
      properties:
        type:
          type: string
          enum:
            - string
            - number
            - object
            - date
            - datetime
            - geopoint
            - boolean
            - image_url
        array:
          type: boolean
          description: Indicates whether the definition is an array.
        optional:
          type: boolean
          description: >-
            Indicates whether this definition is optional or not optional for
            the resource.
        objectType:
          type: string
          nullable: true
          description: >-
            Returns the name of the custom resource if the resource was
            previously defined in the Dashboard as a custom (non-standard)
            Nested object.
        eq:
          type: array
          description: >-
            Array of possible values when the setting for `is equal to any of`
            in the Dashboard is defined explicitly.
          items: {}
        ne:
          type: array
          description: >-
            Array of values that are not allowed when the setting for `is not
            equal to any of` in the Dashboard is defined explicitly.
          items: {}
        lt:
          type: integer
          description: A property of `number` type must have `less than` this value.
        lte:
          type: integer
          description: >-
            A property of `number` type must be `less than or equal` to this
            value.
        gt:
          type: integer
          description: A property of `number` type must be `greater than` this value.
        gte:
          type: integer
          description: >-
            A property of `number` type must be `greater than or equal` to this
            value.
        deleted:
          type: boolean
          description: Indicates whether the definition was deleted from the schema.
        maxLength:
          type: integer
          description: >-
            Value for maximum length when the setting for `has maximum length
            of` in the Dashboard is defined explicitly.
        minLength:
          type: integer
          description: >-
            Value indicating minimum length when the setting for `has minimum
            length of` in the Dashboard is defined explicitly.
        exactLength:
          type: integer
          description: >-
            Value indicating exact length when the setting for `has exact length
            of` in the Dashboard is defined explicitly.
      required:
        - type
        - optional
        - array
  securitySchemes:
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header
    X-Voucherify-OAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://api.voucherify.io/v1/oauth/token
          scopes:
            api: Gives access to whole server-side API.
            vouchers: >-
              Gives access to all endpoints and methods starting with
              `v1/vouchers`.
            client_api: Gives access to whole client-side API.
            client_vouchers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/vouchers`.
            promotions: >-
              Gives access to all endpoints and methods starting with
              `/v1/promotions`.
            client_promotions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/promotions`
            campaigns: >-
              Gives access to all endpoints and methods starting with
              `v1/campaigns`.
            client_publish: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/publish`.
            exports: >-
              Gives access to all endpoints and methods starting with
              `/v1/exports`.
            publications: >-
              Gives access to all endpoints and methods starting with
              `/v1/publications`.
            client_validate: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validate`.
            validations: >-
              Gives access to all endpoints and methods starting with
              `/v1/validations`.
            client_validations: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validations`.
            qualifications: >-
              Gives access to all endpoints and methods starting with
              `/v1/qualifications`.
            client_qualifications: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/qualifications`.
            client_redeem: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redeem
            redemptions: >-
              Gives access to all endpoints and methods starting with
              `/v1/redemptions`.
            client_redemptions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redemptions`
            customers: >-
              Gives access to all endpoints and methods starting with
              `/v1/customers`.
            client_customers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/customers`.
            orders: >-
              Gives access to all endpoints and methods starting with
              `/v1/orders`.
            products: >-
              Gives access to all endpoints and methods starting with
              `/v1/products`.
            skus: >-
              Gives access to all endpoints and methods starting with
              `/v1/SKUs`.
            validation-rules: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules`.
            validation-rules-assignments: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules-assignments
            segments: >-
              Gives access to all endpoints and methods starting with
              `/v1/segments`.
            events: >-
              Gives access to all endpoints and methods starting with
              `/v1/events`.
            client_events: >-
              Gives access to all endpoints and methods starting with
              `client/v1/events`.
            rewards: >-
              Gives access to all endpoints and methods starting with
              `/v1/rewards`.
            assets: >-
              Gives access to all endpoints and methods starting with
              `/v1/assets`.
            task-results: >-
              Gives access to all endpoints and methods starting with
              `/v1/task-results`.
            loyalties: >-
              Gives access to all endpoints and methods starting with
              `/v1/loyalties`.
            client_consents: >-
              Gives access to all endpoints and methods starting with
              `client/v1/consents`.
            consents: >-
              Gives access to all endpoints and methods starting with
              `/v1/consents`.
            async-actions: >-
              Gives access to all endpoints and methods starting with
              `/v1/async-actions`.
            product-collections: >-
              Gives access to all endpoints and methods starting with
              `/v1/product-collections`.
            categories: >-
              Gives access to all endpoints and methods starting with
              `/v1/categories`.
            metadata-schemas: >-
              Gives access to all endpoints and methods starting with
              `/v1/metadata-schemas`.
            locations: >-
              Gives access to all endpoints and methods starting with
              `/v1/locations`.
            referrals: >-
              Gives access to all endpoints and methods starting with
              `/v1/referrals`.
            trash-bin: >-
              Gives access to all endpoints and methods starting with
              `/v1/trash-bin`.
            templates: >-
              Gives access to all endpoints and methods starting with
              `/v1/templates`.

````