> ## 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.

> 📘 Metadata Documentation
>
> Read [the Getting Started with Metadata](/prepare/metadata) and [Metadata Mapping](/guides/metadata-mapping) articles to learn how metadata work in Voucherify.



## OpenAPI

````yaml /openapi/management.json get /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId}
openapi: 3.0.1
info:
  title: Voucherify API - Management
  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:
  /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId}:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterProjectId'
        in: path
        name: projectId
        description: Provide the unique identifier of the project.
        required: true
      - schema:
          $ref: '#/components/schemas/ParameterMetadataSchemaId'
        in: path
        name: metadataSchemaId
        description: Provide the unique identifier of the metadata schema.
        required: true
    get:
      tags:
        - Management
      summary: Get Metadata Schema
      description: >-
        Retrieves a metadata schema.


        > 📘 Metadata Documentation

        >

        > Read [the Getting Started with Metadata](/prepare/metadata) and
        [Metadata Mapping](/guides/metadata-mapping) articles to learn how
        metadata work in Voucherify.
      operationId: get-metadata-schema-1
      parameters: []
      responses:
        '200':
          description: Returns the metadata schema.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ManagementProjectsMetadataSchemasGetResponseBody
              examples:
                Example:
                  value:
                    id: ms_f1r5Tm3ta6a4a5ch3ma
                    related_object: order
                    properties:
                      region:
                        type: string
                        array: false
                        optional: true
                        object_type: null
                        eq:
                          - EU
                          - US
                          - EMEA
                          - APAC
                      location_id:
                        type: string
                        array: true
                        optional: true
                        object_type: null
                        eq:
                          - L1
                          - L2
                          - L3
                      payment_mean:
                        type: string
                        array: true
                        optional: true
                        object_type: null
                        eq:
                          - credit-card
                          - wire-transfer
                          - paypal
                      booking_end_date:
                        type: datetime
                        array: false
                        optional: true
                        object_type: null
                      booking_start_date:
                        type: datetime
                        array: false
                        optional: true
                        object_type: null
                    allow_defined_only: false
                    created_at: '2023-08-03T10:37:48.662Z'
                    updated_at: '2023-08-28T11:24:43.518Z'
                    object: metadata_schema
        '401':
          description: Returns an error if an invalid token was provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Unauthorized:
                  value:
                    code: 401
                    message: Unauthorized
                    key: unauthorized
        '402':
          description: >-
            Returns an error if the current plan does not include the Management
            API feature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorPaymentRequired'
              examples:
                Example:
                  value:
                    code: 402
                    message: Payment required
                    details: >-
                      Your current plan does not include a feature required to
                      perform this operation.
                    key: missing_required_feature
        '404':
          description: Returns an error when a resource could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Resource not found:
                  value:
                    code: 404
                    message: Resource not found
                    details: Cannot find project with id proj_2F3txY7
      security:
        - X-Management-Id: []
          X-Management-Token: []
components:
  schemas:
    ParameterProjectId:
      type: string
      example: proj_TrlkLiH4
    ParameterMetadataSchemaId:
      type: string
      example: ms_f0r4hm3ta6a4a5ch3ma
    ManagementProjectsMetadataSchemasGetResponseBody:
      type: object
      title: Management Projects Metadata Schemas Get Response Body
      description: >-
        Response body schema for **GET**
        `management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId}`.
      allOf:
        - $ref: '#/components/schemas/ManagementProjectsMetadataSchema'
    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
    ErrorPaymentRequired:
      title: Payment Required Error
      type: object
      description: 'Error: Payment required - the current plan does not include the feature.'
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        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.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
      required:
        - code
        - message
        - details
        - key
    ManagementProjectsMetadataSchema:
      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/ManagementProjectsMetadataSchemaDefinition
          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
    ManagementProjectsMetadataSchemaDefinition:
      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
          description: >-
            Indicates the type of metadata. Note that `"geopoint"` type is a
            paid feature.
          enum:
            - string
            - number
            - object
            - date
            - datetime
            - geopoint
            - boolean
            - image_url
        optional:
          type: boolean
          description: Indicates if this definition is optional or not for the resource.
        array:
          type: boolean
          description: Indicates if the definition is an array.
        deleted:
          type: boolean
          description: Indicates if the definition has been deleted from the schema.
        object_type:
          type: string
          nullable: true
          description: >-
            The name of the custom resource (i.e. a nested object) if the
            resource has been previously defined. Otherwise, it is `null` for
            other types.
        min_length:
          type: integer
          description: >-
            Value indicating the minimum length. Available only for the `string`
            type.
        max_length:
          type: integer
          description: >-
            Value indicating the maximum length. Available only for the `string`
            type.
        exact_length:
          type: integer
          description: >-
            Value indicating the exact length. Available only for the `string`
            type.
        eq:
          type: array
          description: >-
            Array of values that are allowed. Available only for the `string`
            and `number` types.
          items:
            oneOf:
              - title: Add number
                description: >-
                  Adds numbers to the array. The value should be up to two
                  decimal places.
                type: number
              - title: Add string
                description: Adds strings to the array.
                type: string
        ne:
          type: array
          description: >-
            Array of values that are not allowed. Available only for the
            `number` type.
          items:
            description: >-
              Adds number to the array. The value should be up to two decimal
              places.
            type: number
        lt:
          type: number
          description: >-
            A property of the `number` type must have `less than` this value.
            The value should be up to two decimal places.
        lte:
          type: number
          description: >-
            A property of the `number` type must be `less than or equal` to this
            value. The value should be up to two decimal places.
        gt:
          type: number
          description: >-
            A property of `number` type must be `greater than` this value. The
            value should be up to two decimal places.
        gte:
          type: number
          description: >-
            A property of `number` type must be `greater than or equal` to this
            value. The value should be up to two decimal places.
      required:
        - type
        - optional
        - array
  securitySchemes:
    X-Management-Id:
      type: apiKey
      name: X-Management-Id
      in: header
    X-Management-Token:
      type: apiKey
      name: X-Management-Token
      in: header

````