{
  "openapi": "3.0.1",
  "info": {
    "title": "Voucherify API - Orders",
    "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"
          ]
        }
      }
    }
  ],
  "paths": {
    "/v1/orders": {
      "get": {
        "operationId": "list-orders",
        "tags": [
          "Orders"
        ],
        "summary": "List Orders",
        "description": "Returns a list of orders.\n\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "schema": {
              "$ref": "#/components/schemas/ParameterOrderListOrders"
            },
            "in": "query",
            "name": "order",
            "description": "This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order."
          }
        ],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "orders"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a dictionary with order objects. The orders are returned sorted by creation date by default, with the most recent orders appearing last, unless you specify another sequence using the order query parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrdersListResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "object": "list",
                      "data_ref": "orders",
                      "orders": [
                        {
                          "id": "ord_v5vupdacgud1CwUSyKqSlHuk",
                          "source_id": null,
                          "created_at": "2022-09-09T07:44:41.594Z",
                          "updated_at": "2022-09-09T07:44:42.331Z",
                          "status": "PAID",
                          "amount": 2700,
                          "discount_amount": 1243,
                          "items_discount_amount": 270,
                          "total_discount_amount": 1513,
                          "total_amount": 1187,
                          "items": [
                            {
                              "object": "order_item",
                              "source_id": "prod_5h1pp1ng",
                              "related_object": "product",
                              "quantity": 1,
                              "amount": 700,
                              "discount_amount": 70,
                              "price": 700,
                              "subtotal_amount": 630,
                              "product": {
                                "name": "Shipping"
                              }
                            },
                            {
                              "object": "order_item",
                              "source_id": "roses_1",
                              "related_object": "product",
                              "quantity": 1,
                              "amount": 500,
                              "discount_amount": 50,
                              "price": 500,
                              "subtotal_amount": 450,
                              "product": {
                                "name": "Bouquet - Romantic Roses",
                                "price": 500
                              }
                            },
                            {
                              "object": "order_item",
                              "source_id": "vase_1",
                              "related_object": "product",
                              "quantity": 1,
                              "amount": 1500,
                              "discount_amount": 150,
                              "price": 1500,
                              "subtotal_amount": 1350,
                              "product": {
                                "name": "Vase - Boho Vintage",
                                "price": 1500
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                            "object": "customer"
                          },
                          "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0baa093537528ef645": {
                              "date": "2022-09-09T07:44:41.695Z",
                              "related_object_type": "redemption",
                              "related_object_id": "r_0baa093537528ef645",
                              "stacked": [
                                "r_0baa093537528ef646",
                                "r_0baa093537528ef647",
                                "r_0baa093537528ef648"
                              ]
                            }
                          }
                        },
                        {
                          "id": "ord_3JkWC6jG0JgyRf5lO3r4IyU1",
                          "source_id": null,
                          "created_at": "2022-09-09T07:04:22.597Z",
                          "updated_at": "2022-09-09T07:04:23.743Z",
                          "status": "PAID",
                          "amount": 73100,
                          "items_discount_amount": 7310,
                          "total_discount_amount": 7310,
                          "total_amount": 65790,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 1,
                              "amount": 70000,
                              "discount_amount": 7000,
                              "price": 70000,
                              "subtotal_amount": 63000,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619",
                              "quantity": 1,
                              "amount": 1600,
                              "discount_amount": 160,
                              "price": 1600,
                              "subtotal_amount": 1440,
                              "product": {
                                "name": "Comic Books1",
                                "price": 1600
                              },
                              "sku": {
                                "sku": "Comics1",
                                "price": 1600
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b72b0bd64d198e3ae",
                              "quantity": 1,
                              "amount": 1500,
                              "discount_amount": 150,
                              "price": 1500,
                              "subtotal_amount": 1350,
                              "product": {
                                "name": "Vase - Boho Vintage",
                                "price": 1500
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                            "object": "customer"
                          },
                          "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba9fffae90e1b2495": {
                              "date": "2022-09-09T07:04:22.692Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_24rljiUfdLNC9poBf0BPNmoh2txzFkLs"
                            }
                          }
                        },
                        {
                          "id": "ord_HwdbziIPvUZJkIC7z74FKmPv",
                          "source_id": null,
                          "created_at": "2022-09-09T06:47:14.195Z",
                          "updated_at": "2022-09-09T06:47:15.369Z",
                          "status": "PAID",
                          "amount": 71600,
                          "discount_amount": 7160,
                          "total_discount_amount": 7160,
                          "total_amount": 64440,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619",
                              "quantity": 1,
                              "amount": 1600,
                              "price": 1600,
                              "subtotal_amount": 1600,
                              "product": {
                                "name": "Comic Books1",
                                "price": 1600
                              },
                              "sku": {
                                "sku": "Comics1",
                                "price": 1600
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 1,
                              "amount": 70000,
                              "price": 70000,
                              "subtotal_amount": 70000,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                            "object": "customer"
                          },
                          "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba9fc0eb00e1b2230": {
                              "date": "2022-09-09T06:47:14.369Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_3vEprqa6tbzfhFtpjr4mDlkNchXepW7s"
                            }
                          }
                        },
                        {
                          "id": "ord_HRluwFS2seoILUkXxWML0D7Z",
                          "source_id": null,
                          "created_at": "2022-09-09T06:44:27.383Z",
                          "updated_at": "2022-09-09T06:44:28.252Z",
                          "status": "PAID",
                          "amount": 71600,
                          "discount_amount": 100,
                          "total_discount_amount": 100,
                          "total_amount": 71500,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619",
                              "quantity": 1,
                              "amount": 1600,
                              "price": 1600,
                              "subtotal_amount": 1600,
                              "product": {
                                "name": "Comic Books1",
                                "price": 1600
                              },
                              "sku": {
                                "sku": "Comics1",
                                "price": 1600
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 1,
                              "amount": 70000,
                              "price": 70000,
                              "subtotal_amount": 70000,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                            "object": "customer"
                          },
                          "referrer": {
                            "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                            "object": "customer"
                          },
                          "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                          "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                          "object": "order",
                          "redemptions": {
                            "r_0ba9fb6bb7928ed9ec": {
                              "date": "2022-09-09T06:44:27.486Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_vhHuiEmZSchWHtE0xKm0HM7PFCR9cNkA",
                              "related_object_parent_id": "camp_rRsfatlwN7unSeUIJDCYedal"
                            }
                          }
                        },
                        {
                          "id": "ord_Qg5utCohAZ3tafYvc1O4C80r",
                          "source_id": null,
                          "created_at": "2022-09-09T06:42:34.083Z",
                          "updated_at": "2022-09-09T06:42:35.169Z",
                          "status": "PAID",
                          "amount": 70000,
                          "discount_amount": 4000,
                          "total_discount_amount": 4000,
                          "total_amount": 66000,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 1,
                              "amount": 70000,
                              "price": 70000,
                              "subtotal_amount": 70000,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                            "object": "customer"
                          },
                          "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba9fafd11d28ed999": {
                              "date": "2022-09-09T06:42:34.183Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_RaMaTT7F0Q47BetdGcFxsyqwo1aZGzJs",
                              "related_object_parent_id": "camp_hg7ajfHh6DcE1xa18mw3SdF6"
                            }
                          }
                        },
                        {
                          "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P",
                          "source_id": null,
                          "created_at": "2022-09-09T06:38:17.984Z",
                          "updated_at": "2022-09-09T06:38:19.064Z",
                          "status": "PAID",
                          "amount": 4600,
                          "items_discount_amount": 300,
                          "total_discount_amount": 300,
                          "total_amount": 4300,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619",
                              "quantity": 1,
                              "amount": 1600,
                              "price": 1600,
                              "subtotal_amount": 1600,
                              "product": {
                                "name": "Comic Books1",
                                "price": 1600
                              },
                              "sku": {
                                "sku": "Comics1",
                                "price": 1600
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0a65b3ff8592d7a5b5",
                              "quantity": 1,
                              "amount": 3000,
                              "discount_amount": 300,
                              "price": 3000,
                              "subtotal_amount": 2700,
                              "product": {
                                "name": "Koffee Cup",
                                "price": 3000
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                            "object": "customer"
                          },
                          "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba9fa02fcd28ed8f1": {
                              "date": "2022-09-09T06:38:18.099Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40",
                              "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1"
                            }
                          }
                        },
                        {
                          "id": "ord_N3YBowDTZs0UH2hHoMZLbUDN",
                          "source_id": null,
                          "created_at": "2022-09-09T06:18:31.459Z",
                          "updated_at": "2022-09-09T06:18:31.624Z",
                          "status": "PAID",
                          "amount": 71600,
                          "discount_amount": 7160,
                          "total_discount_amount": 7160,
                          "total_amount": 64440,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 1,
                              "amount": 70000,
                              "price": 70000,
                              "subtotal_amount": 70000,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619",
                              "quantity": 1,
                              "amount": 1600,
                              "price": 1600,
                              "subtotal_amount": 1600,
                              "product": {
                                "name": "Comic Books1",
                                "price": 1600
                              },
                              "sku": {
                                "sku": "Comics1",
                                "price": 1600
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                            "object": "customer"
                          },
                          "customer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba9f57c37128ed639": {
                              "date": "2022-09-09T06:18:31.516Z",
                              "related_object_type": "promotion_tier",
                              "related_object_id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G",
                              "related_object_parent_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0"
                            }
                          }
                        },
                        {
                          "id": "ord_3R6vsxRZRkND8rpe0rAn9Agc",
                          "source_id": null,
                          "created_at": "2022-09-05T08:13:13.720Z",
                          "updated_at": "2022-09-05T08:13:14.498Z",
                          "status": "PAID",
                          "amount": 74000,
                          "items_discount_amount": 1500,
                          "total_discount_amount": 1500,
                          "total_amount": 72500,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 1,
                              "amount": 70000,
                              "price": 70000,
                              "subtotal_amount": 70000,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b72b0bd64d198e3ae",
                              "quantity": 2,
                              "amount": 3000,
                              "discount_amount": 500,
                              "price": 1500,
                              "subtotal_amount": 2500,
                              "product": {
                                "name": "Vase - Boho Vintage",
                                "price": 1500
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b72b00ffed198e344",
                              "quantity": 2,
                              "amount": 1000,
                              "discount_amount": 1000,
                              "price": 500,
                              "subtotal_amount": 0,
                              "product": {
                                "name": "Bouquet - Romantic Roses",
                                "price": 500
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_CSnYd37MXmrbS19XCrghjBsv",
                            "object": "customer"
                          },
                          "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba4e961444579711a": {
                              "date": "2022-09-05T08:13:13.873Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_hwySVBBk6YmMD4GzZHJzke1Fxo3QO7kP",
                              "related_object_parent_id": "camp_Uji5a53s5wRSUHqznncTkhHh"
                            }
                          }
                        },
                        {
                          "id": "ord_7bqlkoHyEJCQuxVZpKfZYNeA",
                          "source_id": null,
                          "created_at": "2022-09-02T17:12:13.213Z",
                          "updated_at": "2022-09-02T17:12:13.969Z",
                          "status": "PAID",
                          "amount": 292400,
                          "items_discount_amount": 900,
                          "total_discount_amount": 900,
                          "total_amount": 291500,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619",
                              "quantity": 4,
                              "amount": 6400,
                              "price": 1600,
                              "subtotal_amount": 6400,
                              "product": {
                                "name": "Comic Books1",
                                "price": 1600
                              },
                              "sku": {
                                "sku": "Comics1",
                                "price": 1600
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b72b0bd64d198e3ae",
                              "quantity": 4,
                              "amount": 6000,
                              "price": 1500,
                              "subtotal_amount": 6000,
                              "product": {
                                "name": "Vase - Boho Vintage",
                                "price": 1500
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 4,
                              "amount": 280000,
                              "discount_amount": 900,
                              "price": 70000,
                              "subtotal_amount": 279100,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_CSnYd37MXmrbS19XCrghjBsv",
                            "object": "customer"
                          },
                          "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba187f9bb45792c13": {
                              "date": "2022-09-02T17:12:13.293Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_pg6DhwhmeZASoSoJ15PdzMT9MhsPjYuc",
                              "related_object_parent_id": "camp_W8DJVd8J0btqXT6FBwn7BSkC"
                            }
                          }
                        },
                        {
                          "id": "ord_7HwbJiHmS07O7FsVAtjJcuRS",
                          "source_id": null,
                          "created_at": "2022-09-02T17:08:37.794Z",
                          "updated_at": "2022-09-02T17:08:38.879Z",
                          "status": "PAID",
                          "amount": 223900,
                          "items_discount_amount": 900,
                          "total_discount_amount": 900,
                          "total_amount": 223000,
                          "items": [
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619",
                              "quantity": 4,
                              "amount": 6400,
                              "discount_amount": 300,
                              "price": 1600,
                              "subtotal_amount": 6100,
                              "product": {
                                "name": "Comic Books1",
                                "price": 1600
                              },
                              "sku": {
                                "sku": "Comics1",
                                "price": 1600
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b7d7c4e814be5c502",
                              "quantity": 3,
                              "amount": 210000,
                              "discount_amount": 300,
                              "price": 70000,
                              "subtotal_amount": 209700,
                              "product": {
                                "name": "Apple iPhone 12",
                                "price": 70000
                              }
                            },
                            {
                              "object": "order_item",
                              "product_id": "prod_0b72b0bd64d198e3ae",
                              "quantity": 5,
                              "amount": 7500,
                              "discount_amount": 300,
                              "price": 1500,
                              "subtotal_amount": 7200,
                              "product": {
                                "name": "Vase - Boho Vintage",
                                "price": 1500
                              }
                            }
                          ],
                          "metadata": {},
                          "customer": {
                            "id": "cust_CSnYd37MXmrbS19XCrghjBsv",
                            "object": "customer"
                          },
                          "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv",
                          "referrer_id": null,
                          "object": "order",
                          "redemptions": {
                            "r_0ba1872762c5792b73": {
                              "date": "2022-09-02T17:08:37.899Z",
                              "related_object_type": "voucher",
                              "related_object_id": "v_yQydppWWJpSUuGNEWJ4I2upFGY2Ma4IY",
                              "related_object_parent_id": "camp_A5L21BD4cJii28882owYBqTV"
                            }
                          }
                        }
                      ],
                      "total": 441
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "create-order",
        "tags": [
          "Orders"
        ],
        "summary": "Create Order",
        "description": "Creates an order object and triggers an order creation event.\n\n\n\n<Note>\n\n<Badge color=\"blue\">Upsert Mode</Badge>\n\nIf you pass an `id` or a `source_id` that already exists in the order database, Voucherify will return a related order object with updated fields.\n\n</Note>",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "orders"
            ]
          }
        ],
        "requestBody": {
          "description": "Specify the order parameters.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrdersCreateRequestBody"
              },
              "examples": {
                "Example": {
                  "value": {
                    "amount": 20000,
                    "customer": {
                      "source_id": "sample_customer"
                    },
                    "status": "PAID",
                    "items": [
                      {
                        "quantity": 1,
                        "price": 20000,
                        "source_id": "sample product1",
                        "related_object": "product",
                        "product": {
                          "metadata": {
                            "key": "value"
                          }
                        }
                      }
                    ]
                  }
                },
                "Example 2": {
                  "value": {
                    "source_id": "new",
                    "status": "FULFILLED",
                    "metadata": {
                      "location_id": [
                        "L1",
                        "L2"
                      ],
                      "payment_mean": [
                        "paypal",
                        "credit-card"
                      ]
                    },
                    "customer": {
                      "source_id": "bob.smith.1@email.com",
                      "name": "Bob Smith",
                      "description": "A nice customer",
                      "email": "bob.smith.1@email.com",
                      "phone": "+1 933 222 3333",
                      "address": {
                        "city": "New York",
                        "country": "United Statese",
                        "line_1": "123 Main St",
                        "line_2": "APT 3 BLG 4",
                        "postal_code": "10001",
                        "state": "NY"
                      },
                      "metadata": {
                        "lang": "en",
                        "test": false
                      },
                      "birthdate": "2022-01-02"
                    },
                    "referrer": {
                      "source_id": "jane.smith@email.com",
                      "name": "Jane Smith",
                      "description": "A really nice customer",
                      "email": "jane.smith@email.com",
                      "phone": "+1 933 222 3334",
                      "address": {
                        "city": "New York",
                        "country": "United States",
                        "line_1": "123 Main St.",
                        "line_2": "APT 3 BLG 4",
                        "postal_code": "10001",
                        "state": "NY"
                      },
                      "metadata": {
                        "lang": "en",
                        "test": false
                      },
                      "birthday": "2022-03-03"
                    },
                    "items": [
                      {
                        "source_id": "prod_1",
                        "related_object": "product",
                        "quantity": 2,
                        "product": {
                          "name": "Apple iPhone 12",
                          "price": 60000,
                          "metadata": {
                            "color": [
                              "purple"
                            ],
                            "vendor": "mall"
                          },
                          "override": true
                        }
                      },
                      {
                        "source_id": "ComicBook_1",
                        "related_object": "sku",
                        "quantity": 1,
                        "product": {
                          "source_id": "Books",
                          "name": "Comic Books1",
                          "price": 2100,
                          "metadata": {
                            "color": [
                              "silver"
                            ],
                            "vendor": "Bookstore1"
                          },
                          "override": true
                        },
                        "sku": {
                          "sku": "Comics1",
                          "source_id": "ComicBook_1",
                          "price": 1700,
                          "metadata": {
                            "color": [
                              "golden"
                            ],
                            "vendor": "islands"
                          },
                          "override": true
                        }
                      }
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns an order object if the operation succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrdersCreateResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH",
                      "source_id": "new",
                      "created_at": "2022-09-09T09:20:01.660Z",
                      "updated_at": "2022-09-09T09:24:43.604Z",
                      "status": "FULFILLED",
                      "amount": 121700,
                      "total_amount": 121700,
                      "items": [
                        {
                          "object": "order_item",
                          "source_id": "prod_1",
                          "related_object": "product",
                          "quantity": 2,
                          "amount": 120000,
                          "price": 60000,
                          "subtotal_amount": 120000,
                          "product": {
                            "id": "prod_0b7d7c4e814be5c502",
                            "source_id": "prod_1",
                            "name": "Apple iPhone 12",
                            "metadata": {
                              "color": [
                                "purple"
                              ],
                              "vendor": "mall"
                            },
                            "price": 60000
                          }
                        },
                        {
                          "object": "order_item",
                          "source_id": "ComicBook_1",
                          "related_object": "sku",
                          "product_id": "prod_0b7d7dfb05cbe5c616",
                          "quantity": 1,
                          "amount": 1700,
                          "price": 1700,
                          "subtotal_amount": 1700,
                          "product": {
                            "id": "prod_0b7d7dfb05cbe5c616",
                            "source_id": "Books",
                            "name": "Comic Books1",
                            "metadata": {
                              "color": [
                                "silver"
                              ],
                              "vendor": "Bookstore1"
                            },
                            "price": 2100
                          },
                          "sku": {
                            "id": "sku_0b7d7dfb090be5c619",
                            "source_id": "ComicBook_1",
                            "sku": "Comics1",
                            "metadata": {
                              "color": [
                                "golden"
                              ],
                              "vendor": "islands"
                            },
                            "price": 1700
                          }
                        }
                      ],
                      "metadata": {
                        "location_id": [
                          "L1",
                          "L2"
                        ],
                        "payment_mean": [
                          "paypal",
                          "credit-card"
                        ]
                      },
                      "customer": {
                        "id": "cust_H0nXrItO1DNV3UiPIl54HA5o",
                        "object": "customer"
                      },
                      "referrer": {
                        "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                        "object": "customer"
                      },
                      "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o",
                      "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                      "object": "order"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/{orderId}": {
      "parameters": [
        {
          "schema": {
            "$ref": "#/components/schemas/ParameterOrderId"
          },
          "name": "orderId",
          "in": "path",
          "required": true,
          "description": "Unique Voucherify order ID or order source ID."
        }
      ],
      "get": {
        "operationId": "get-order",
        "tags": [
          "Orders"
        ],
        "summary": "Get Order",
        "description": "Retrieve a specific order by passing its ID.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "orders"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Returns an order object if a valid identifier was provided. ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrdersGetResponseBody"
                }
              }
            }
          },
          "404": {
            "description": "Returns an error when requesting an order that has been deleted or cannot be 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 order with id ord_nIcO2s8iD4Xh5E9IGDQ57Ax",
                      "request_id": "v-0baa1ad023d0656a84",
                      "resource_id": "ord_nIcO2s8iD4Xh5E9IGDQ57Ax",
                      "resource_type": "order"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "update-order",
        "tags": [
          "Orders"
        ],
        "summary": "Update Order",
        "description": "Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "orders"
            ]
          }
        ],
        "requestBody": {
          "description": "Specify the parameters of the order that are to be updated.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrdersUpdateRequestBody"
              },
              "examples": {
                "Example": {
                  "value": {
                    "status": "CANCELED"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns the order object if the update succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrdersUpdateResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH",
                      "source_id": "new",
                      "created_at": "2022-09-09T09:20:01.660Z",
                      "updated_at": "2022-09-09T09:41:00.881Z",
                      "status": "CANCELED",
                      "amount": 121700,
                      "total_amount": 121700,
                      "items": [
                        {
                          "object": "order_item",
                          "source_id": "prod_1",
                          "related_object": "product",
                          "quantity": 2,
                          "amount": 120000,
                          "price": 60000,
                          "subtotal_amount": 120000,
                          "product": {
                            "id": "prod_0b7d7c4e814be5c502",
                            "source_id": "prod_1",
                            "name": "Apple iPhone 12",
                            "metadata": {
                              "color": [
                                "purple"
                              ],
                              "vendor": "mall"
                            },
                            "price": 60000
                          }
                        },
                        {
                          "object": "order_item",
                          "source_id": "ComicBook_1",
                          "related_object": "sku",
                          "product_id": "prod_0b7d7dfb05cbe5c616",
                          "quantity": 1,
                          "amount": 1700,
                          "price": 1700,
                          "subtotal_amount": 1700,
                          "product": {
                            "id": "prod_0b7d7dfb05cbe5c616",
                            "source_id": "Books",
                            "name": "Comic Books1",
                            "metadata": {
                              "color": [
                                "silver"
                              ],
                              "vendor": "Bookstore1"
                            },
                            "price": 2100
                          },
                          "sku": {
                            "id": "sku_0b7d7dfb090be5c619",
                            "source_id": "ComicBook_1",
                            "sku": "Comics1",
                            "metadata": {
                              "color": [
                                "golden"
                              ],
                              "vendor": "islands"
                            },
                            "price": 1700
                          }
                        }
                      ],
                      "metadata": {
                        "location_id": [
                          "L1",
                          "L2"
                        ],
                        "payment_mean": [
                          "paypal",
                          "credit-card"
                        ]
                      },
                      "customer": {
                        "id": "cust_H0nXrItO1DNV3UiPIl54HA5o",
                        "object": "customer"
                      },
                      "referrer": {
                        "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                        "object": "customer"
                      },
                      "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o",
                      "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
                      "object": "order"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/import": {
      "post": {
        "operationId": "import-orders",
        "tags": [
          "Orders"
        ],
        "summary": "Import Orders",
        "description": "\n\n<Warning>\n\n<Badge color=\"yellow\">Historical orders</Badge>\n\nThis endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the [update order](/api-reference/orders/update-order) endpoint should be used. This is critical because this endpoint does not store events or launch distributions.\n\n</Warning>\nThe orders will also have a `created_at` date that's assigned when they've been imported to Voucherify. To keep track of the actual order creation date, add an order metadata in ISO 8601 date or date time format to each imported order.\n\n## Limitations\n\n### Import volume\n\nThere can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one.  \n\n### Maximum count of orders in single import\n\nThere is a `2000` limit of orders per one request.\n\n## Notifications\n\nThere are no notifications on the Dashboard because this import is launched via the API.\n\n## Triggered actions\n  \nIf you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segment's summary. Consequently, this update will trigger \n- Customers entering into segments\n- Distributions based on any rules tied to customer entering segment(s)\n- Earning rules based on the customer entering segment(s)\n\n## What is not triggered\n\n1. No webhooks are triggered during the import of orders - for both orders and upserted products / SKUs.  \n\n2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a `PAID` status, the distribution is not going to be triggered.    \n\n3. No events are created during the import of orders - for both orders and upserted products / SKUs. In other words you won't see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / SKUs, then you won't see the Product created events listed, etc.   \n\n4. Earning rules based on Order Paid won't be triggered.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the `IN_PROGRESS` status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. \n\nThe result will return the async ID. You can verify the status of your request with [GET Async Action](/api-reference/async-actions/get-async-action) endpoint.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "orders"
            ]
          }
        ],
        "requestBody": {
          "description": "The request body is sent in the form of an array of order objects.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrdersImportCreateRequestBody"
              },
              "examples": {
                "Example": {
                  "value": [
                    {
                      "source_id": "orderImport14",
                      "status": "PAID",
                      "metadata": {
                        "location_id": [
                          "L1",
                          "L2"
                        ],
                        "payment_mean": [
                          "paypal",
                          "credit-card"
                        ]
                      },
                      "customer": {
                        "source_id": "bob2.smith@email.com",
                        "name": "Bob Smith",
                        "description": "A nice customer",
                        "email": "bob.smith@email.com",
                        "phone": "+1 933 222 3333",
                        "address": {
                          "city": "New York",
                          "country": "United States",
                          "line_1": "123 Main St.",
                          "line_2": "APT 3 BLG 4",
                          "postal_code": "10001",
                          "state": "NY"
                        },
                        "metadata": {
                          "lang": "en",
                          "test": true
                        },
                        "birthdate": "2022-01-01"
                      },
                      "referrer": {
                        "source_id": "jane.smith@email.com",
                        "name": "Jane Smith",
                        "description": "A really nice customer",
                        "email": "jane.smith@email.com",
                        "phone": "+1 933 222 3334",
                        "address": {
                          "city": "New York",
                          "country": "United States",
                          "line_1": "123 Main St.",
                          "line_2": "APT 3 BLG 4",
                          "postal_code": "10001",
                          "state": "NY"
                        },
                        "metadata": {
                          "lang": "en",
                          "test": false
                        },
                        "birthday": "2022-03-03"
                      },
                      "items": [
                        {
                          "source_id": "prod_1",
                          "related_object": "product",
                          "quantity": 2,
                          "product": {
                            "name": "Apple iPhone 12",
                            "price": 70000,
                            "metadata": {
                              "color": [
                                "silver"
                              ],
                              "vendor": "mall"
                            },
                            "override": true
                          }
                        },
                        {
                          "source_id": "ComicBook_1",
                          "related_object": "sku",
                          "quantity": 1,
                          "product": {
                            "source_id": "Books",
                            "name": "Comic Books1",
                            "price": 1600,
                            "metadata": {
                              "color": [
                                "silver"
                              ],
                              "vendor": "Bookstore1"
                            },
                            "override": true
                          },
                          "sku": {
                            "sku": "Comics1",
                            "source_id": "ComicBook_1",
                            "price": 1600,
                            "metadata": {
                              "color": [
                                "golden"
                              ],
                              "vendor": "islands"
                            },
                            "override": true
                          }
                        }
                      ]
                    },
                    {
                      "source_id": "orderImport15",
                      "status": "PAID",
                      "metadata": {
                        "location_id": [
                          "L3"
                        ],
                        "payment_mean": [
                          "wire-transfer"
                        ]
                      },
                      "customer": {
                        "source_id": "bob2.smith@email.com"
                      },
                      "referrer": {
                        "source_id": "jane.smith@email.com"
                      },
                      "items": [
                        {
                          "source_id": "ComicBook_1",
                          "quantity": 4,
                          "related_object": "sku",
                          "sku": {
                            "source_id": "ComicBook_1"
                          }
                        },
                        {
                          "source_id": "vase_1",
                          "quantity": 1,
                          "related_object": "product",
                          "product": {
                            "source_id": "vase_1"
                          }
                        }
                      ]
                    },
                    {
                      "source_id": "orderImport16",
                      "status": "FULFILLED",
                      "metadata": {
                        "location_id": [
                          "L3"
                        ],
                        "payment_mean": [
                          "wire-transfer"
                        ]
                      },
                      "customer": {
                        "id": "cust_LMY4ZylSdUYB1J4tzqNcl5VV"
                      },
                      "referrer": {
                        "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv"
                      },
                      "items": [
                        {
                          "product_id": "prod_0b72b0bd64d198e3ae",
                          "quantity": 2
                        },
                        {
                          "sku_id": "sku_0b1621b319d248b79f",
                          "quantity": 2
                        }
                      ]
                    },
                    {
                      "source_id": "orderImport17",
                      "status": "CANCELED",
                      "amount": 7000,
                      "metadata": {
                        "location_id": [
                          "L3"
                        ],
                        "payment_mean": [
                          "wire-transfer"
                        ]
                      }
                    },
                    {
                      "source_id": "orderImport18",
                      "status": "CREATED",
                      "metadata": {
                        "location_id": [
                          "L3"
                        ],
                        "payment_mean": [
                          "wire-transfer"
                        ]
                      },
                      "items": [
                        {
                          "source_id": "ComicBook_1",
                          "amount": 900,
                          "related_object": "sku"
                        },
                        {
                          "source_id": "vase_1",
                          "amount": 2000,
                          "related_object": "product"
                        }
                      ]
                    },
                    {
                      "source_id": "orderImport19",
                      "status": "CREATED",
                      "metadata": {
                        "location_id": [
                          "L3"
                        ],
                        "payment_mean": [
                          "wire-transfer"
                        ]
                      },
                      "items": [
                        {
                          "amount": 900
                        },
                        {
                          "amount": 2000
                        }
                      ]
                    },
                    {
                      "source_id": "orderImport20",
                      "status": "CREATED",
                      "metadata": {
                        "location_id": [
                          "L3"
                        ],
                        "payment_mean": [
                          "wire-transfer"
                        ]
                      },
                      "items": [
                        {
                          "price": 900,
                          "quantity": 2
                        },
                        {
                          "price": 2000,
                          "quantity": 3
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the order(s) will be added to the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](/api-reference/async-actions/get-async-action) endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrdersImportCreateResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "async_action_id": "aa_0a875d56c805df6601"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Returns an error if the payload is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Invalid Payload": {
                    "value": {
                      "code": 400,
                      "key": "invalid_payload",
                      "message": "Invalid payload",
                      "details": "Property .items[0].initial_quantity cannot be lower than 1",
                      "request_id": "v-0c5561d945cb0f0fb5"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/export": {
      "post": {
        "operationId": "create-order-export",
        "tags": [
          "Orders"
        ],
        "summary": "Create Orders Export",
        "description": "Creates a downloadable CSV file containing a list of orders.\n\nThe parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the `parameters.fields` object in the request body.\n\nThe available filters are all [order object](/api-reference/orders/order-calculated-object) attributes. Additionally, any metadata defined in the metadata schema can be exported.\n\nPassing an empty JSON will generate a file containing three default fields: `id`, `source_id`, and `status`.\n\nThe fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| `id` | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| `source_id` | Unique order source ID. | 8638 |\n| `created_at` | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| `updated_at` | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| `status` | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| `amount` | Total amount of order items. | 7700 |\n| `discount_amount` | Represents total amount of the discount applied to whole cart. | 500 |\n| `items_discount_amount` | Represents total amount of the discount applied to order line items. | 100 |\n| `total_discount_amount` | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| `total_amount` | Total order amount after applying all discounts. | 7100 |\n| `customer_id` | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| `referrer_id` | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| `metadata` | Returns all order metadata. | Response will include all order metadata. |\n| `metadata.X` | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. |",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "orders"
            ]
          }
        ],
        "requestBody": {
          "description": "Specify which order parameters you would like to export.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrdersExportCreateRequestBody"
              },
              "examples": {
                "Using fields": {
                  "value": {
                    "parameters": {
                      "fields": [
                        "id",
                        "source_id",
                        "status",
                        "created_at",
                        "updated_at",
                        "amount",
                        "discount_amount",
                        "items_discount_amount",
                        "total_discount_amount",
                        "total_amount",
                        "customer_id",
                        "referrer_id",
                        "metadata.payment_mean"
                      ]
                    }
                  }
                },
                "Using fields and filters": {
                  "value": {
                    "parameters": {
                      "fields": [
                        "id",
                        "source_id",
                        "status",
                        "created_at",
                        "updated_at",
                        "amount",
                        "discount_amount",
                        "items_discount_amount",
                        "total_discount_amount",
                        "total_amount",
                        "customer_id",
                        "referrer_id",
                        "metadata.payment_mean"
                      ],
                      "order": "-updated_at",
                      "filters": {
                        "discount_amount": {
                          "conditions": {
                            "$more_than": 100000
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns the `id` of the export object and `status` of the file generation process. The `id` is used in the [Get Export](/api-reference/exports/get-export) method to generate the url for the downloadable CSV file or in the [Download Export](/api-reference/exports/download-export) method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrdersExportCreateResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "id": "exp_pT2Y1mgYsAgRAqsWTGf7PQX7",
                      "object": "export",
                      "created_at": "2022-09-09T10:45:52.362Z",
                      "status": "SCHEDULED",
                      "channel": "API",
                      "exported_object": "order",
                      "parameters": {
                        "fields": [
                          "id",
                          "source_id",
                          "status",
                          "created_at",
                          "updated_at",
                          "amount",
                          "discount_amount",
                          "items_discount_amount",
                          "total_discount_amount",
                          "total_amount",
                          "customer_id",
                          "referrer_id",
                          "metadata.payment_mean"
                        ]
                      },
                      "result": null,
                      "user_id": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Returns an error if the request payload is specified incorrectly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Invalid payload": {
                    "value": {
                      "code": 400,
                      "key": "invalid_payload",
                      "message": "Invalid payload",
                      "details": "Property .parameters.filters should match either `filters[${field}][conditions][${condition}][${index}]` or `filters[${field}][conditions][${condition}]` format and condition must be one of: $in, $not_in, $in_location, $not_in_location, $is, $is_days_ago, $is_days_in_future, $is_not, $has_value, $is_unknown, $contains, $not_contain, $starts_with, $ends_with, $more_than, $less_than, $more_than_ago, $less_than_ago, $more_than_future, $less_than_future, $more_than_equal, $less_than_equal, $after, $before, $count, $count_less, $count_more, $today, $tomorrow, $yesterday, $this_week, $last_week, $next_week, $this_month, $last_month, $next_month, $this_year, $next_year, $last_year, $is_day_of_month, $is_day, $is_month, $is_year, $today_md, $tomorrow_md, $yesterday_md, $this_week_md, $last_week_md, $next_week_md, $this_month_md, $last_month_md, $next_month_md, $is_days_ago_md, $is_more_days_ago_md, $is_less_days_ago_md, $is_days_in_future_md, $is_more_days_in_future_md, $is_less_days_in_future_md, $is_years_ago, $active, $failed, $in_progress, $expired, $before_start, $enabled, $disabled, $redeemed, $redeemable",
                      "request_id": "v-0c52e783650ae585b2"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "$ref": "#/components/schemas/ParameterLimit"
        },
        "description": "Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items."
      },
      "page": {
        "name": "page",
        "in": "query",
        "required": false,
        "schema": {
          "$ref": "#/components/schemas/ParameterPage"
        },
        "description": "Which page of results to return. The lowest value is `1`."
      }
    },
    "schemas": {
      "ParameterOrderListOrders": {
        "type": "string",
        "enum": [
          "created_at",
          "-created_at",
          "updated_at",
          "-updated_at"
        ]
      },
      "OrdersListResponseBody": {
        "type": "object",
        "title": "Orders List Response Body",
        "description": "Response body schema representing **GET** `v1/orders`.",
        "properties": {
          "object": {
            "type": "string",
            "default": "list",
            "enum": [
              "list"
            ],
            "description": "The type of the object represented by JSON. This object stores information about orders in a dictionary."
          },
          "data_ref": {
            "type": "string",
            "default": "orders",
            "enum": [
              "orders"
            ],
            "description": "Identifies the name of the attribute that contains the array of order objects."
          },
          "orders": {
            "type": "array",
            "description": "Contains array of order objects.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/OrderCalculated"
                },
                {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "description": "Array of items applied to the order. It can include up to 500 items.",
                      "items": {
                        "$ref": "#/components/schemas/OrderCalculatedItem"
                      }
                    }
                  }
                }
              ]
            }
          },
          "total": {
            "type": "integer",
            "description": "Total number of orders."
          }
        },
        "required": [
          "object",
          "data_ref",
          "orders",
          "total"
        ]
      },
      "OrdersCreateRequestBody": {
        "title": "Orders Create Request Body",
        "type": "object",
        "description": "Request body schema for **POST** `v1/orders`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Order"
          },
          {
            "title": "Order Customer And Referrer Ids Objects",
            "type": "object",
            "description": "Order information.",
            "properties": {
              "created_at": {
                "type": "string",
                "example": "2021-12-22T10:13:06.487Z",
                "description": "Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.",
                "format": "date-time"
              },
              "referrer_id": {
                "type": "string",
                "nullable": true,
                "description": "Unique referrer ID.",
                "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix"
              },
              "customer": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Customer"
                  }
                ]
              },
              "referrer": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Referrer"
                  }
                ]
              }
            }
          }
        ]
      },
      "OrdersCreateResponseBody": {
        "type": "object",
        "title": "Orders Create Response Body",
        "description": "Response body schema for **POST** `v1/orders`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/OrderCalculated"
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "description": "Array of items applied to the order. It can include up to 500 items.",
                "items": {
                  "$ref": "#/components/schemas/OrderCalculatedItem"
                }
              }
            }
          }
        ]
      },
      "OrdersGetResponseBody": {
        "title": "Orders Get Response Body",
        "description": "Response body schema for **GET** `v1/orders/{orderId}`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/OrderCalculated"
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "description": "Array of items applied to the order. It can include up to 500 items.",
                "items": {
                  "$ref": "#/components/schemas/OrderCalculatedItem"
                }
              }
            }
          }
        ]
      },
      "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"
        ]
      },
      "ParameterOrderId": {
        "type": "string",
        "example": "ord_smEh8p1p6W6DgOmeERk092LG"
      },
      "OrdersUpdateRequestBody": {
        "type": "object",
        "title": "Orders Update Request Body",
        "description": "Request body schema for **PUT** `v1/orders/{orderId}`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/OrderBase"
          },
          {
            "title": "Order Customer And Referrer Ids Objects",
            "type": "object",
            "description": "Order information.",
            "properties": {
              "created_at": {
                "type": "string",
                "example": "2021-12-22T10:13:06.487Z",
                "description": "Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.",
                "format": "date-time"
              },
              "referrer_id": {
                "type": "string",
                "nullable": true,
                "description": "Unique referrer ID.",
                "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix"
              },
              "customer": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Customer"
                  }
                ]
              },
              "referrer": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Referrer"
                  }
                ]
              }
            }
          }
        ]
      },
      "OrdersUpdateResponseBody": {
        "type": "object",
        "title": "Orders Update Response Body",
        "description": "Response body schema for **PUT** `v1/orders/{orderId}`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/OrderCalculated"
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "description": "Array of items applied to the order. It can include up to 500 items.",
                "items": {
                  "$ref": "#/components/schemas/OrderCalculatedItem"
                }
              }
            }
          }
        ]
      },
      "OrdersImportCreateRequestBody": {
        "type": "array",
        "title": "Orders Import Create Request Body",
        "description": "Request body schema for **POST** `/orders/import`.",
        "items": {
          "title": "Orders Import Create Request Body Item",
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/Order"
            },
            {
              "title": "Order Customer And Referrer Ids Objects",
              "type": "object",
              "description": "Order information.",
              "properties": {
                "referrer_id": {
                  "type": "string",
                  "nullable": true,
                  "description": "Unique referrer ID.",
                  "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix"
                },
                "customer": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Customer"
                    }
                  ]
                },
                "referrer": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Referrer"
                    }
                  ]
                }
              }
            }
          ]
        }
      },
      "OrdersImportCreateResponseBody": {
        "type": "object",
        "title": "Orders Import Create Response Body",
        "description": "Response body schema for **POST** `v1/orders/import`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/AsyncActions"
          }
        ]
      },
      "OrdersExportCreateRequestBody": {
        "title": "Orders Export Create Request Body",
        "description": "Request body schema for **POST** `v1/orders/export`.",
        "type": "object",
        "properties": {
          "parameters": {
            "type": "object",
            "properties": {
              "order": {
                "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ExportOrderOrder"
                  }
                ]
              },
              "fields": {
                "type": "array",
                "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.",
                "items": {
                  "$ref": "#/components/schemas/ExportOrderFields"
                }
              },
              "filters": {
                "description": "Filter conditions.",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ExportOrderFilters"
                  }
                ]
              }
            },
            "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data."
          }
        }
      },
      "OrdersExportCreateResponseBody": {
        "title": "Orders Export Create Response Body",
        "description": "Response body schema for **POST** `v1/orders/export`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ExportScheduledBase"
          },
          {
            "$ref": "#/components/schemas/ExportOrderBase"
          }
        ]
      },
      "ParameterLimit": {
        "type": "integer",
        "maximum": 100,
        "minimum": 1
      },
      "ParameterPage": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      },
      "OrderCalculated": {
        "title": "Order Calculated No Customer Data",
        "type": "object",
        "description": "Order information.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request."
          },
          "source_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique source ID of an existing order that will be linked to the redemption of this request."
          },
          "status": {
            "type": "string",
            "description": "The order status.",
            "enum": [
              "CREATED",
              "PAID",
              "CANCELED",
              "FULFILLED"
            ]
          },
          "amount": {
            "type": "integer",
            "description": "This is the sum of the order items' amounts. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "initial_amount": {
            "type": "integer",
            "description": "This is the sum of the order items' amounts before any discount or other effect (e.g. add missing units) is applied. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "discount_amount": {
            "type": "integer",
            "description": "Sum of all order-level discounts applied to the order. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "items_discount_amount": {
            "type": "integer",
            "description": "Sum of all product-specific discounts applied to the order. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "total_discount_amount": {
            "type": "integer",
            "description": "Sum of all order-level AND all product-specific discounts applied to the order. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "total_amount": {
            "type": "integer",
            "description": "Order amount after undoing all the discounts through the rollback redemption. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "applied_discount_amount": {
            "type": "integer",
            "description": "This field shows the order-level discount applied. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "items_applied_discount_amount": {
            "type": "integer",
            "description": "Sum of all product-specific discounts applied in a particular request. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00).  \n`sum(items, i => i.applied_discount_amount)`"
          },
          "total_applied_discount_amount": {
            "type": "integer",
            "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00).  \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`"
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. It can be used to define business validation rules or discount formulas."
          },
          "object": {
            "type": "string",
            "description": "The type of the object represented by JSON.",
            "default": "order",
            "enum": [
              "order"
            ]
          },
          "created_at": {
            "type": "string",
            "example": "2021-12-22T10:13:06.487Z",
            "description": "Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "example": "2021-12-22T10:14:45.316Z",
            "format": "date-time",
            "description": "Timestamp representing the date and time when the order was last updated in ISO 8601 format."
          },
          "customer_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique customer identifier of the customer making the purchase. The ID is assigned by Voucherify.",
            "example": "cust_7iUa6ICKyU6gH40dBU25kQU1"
          },
          "referrer_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique referrer ID.",
            "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix"
          },
          "customer": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CustomerId"
              }
            ]
          },
          "referrer": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReferrerId"
              }
            ]
          },
          "redemptions": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/OrderRedemptionsEntry"
            }
          }
        }
      },
      "OrderCalculatedItem": {
        "type": "object",
        "title": "Order Item Calculated",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the order line item."
          },
          "sku_id": {
            "type": "string",
            "description": "Unique identifier of the SKU. It is assigned by Voucherify."
          },
          "product_id": {
            "type": "string",
            "description": "Unique identifier of the product. It is assigned by Voucherify."
          },
          "related_object": {
            "type": "string",
            "enum": [
              "product",
              "sku"
            ],
            "description": "Used along with the source_id property, can be set to either sku or product."
          },
          "source_id": {
            "type": "string",
            "description": "The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service."
          },
          "quantity": {
            "type": "integer",
            "description": "The quantity of the particular item in the cart."
          },
          "discount_quantity": {
            "type": "integer",
            "description": "Number of dicounted items."
          },
          "initial_quantity": {
            "type": "integer",
            "description": "A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity."
          },
          "amount": {
            "type": "integer",
            "description": "The total amount of the order item (price * quantity)."
          },
          "discount_amount": {
            "type": "integer",
            "description": "Sum of all order-item-level discounts applied to the order."
          },
          "applied_discount_amount": {
            "type": "integer",
            "description": "This field shows the order-level discount applied."
          },
          "applied_discount_quantity": {
            "type": "integer",
            "description": "Number of the discounted items applied in the transaction."
          },
          "applied_quantity": {
            "type": "integer",
            "description": "Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced."
          },
          "applied_quantity_amount": {
            "type": "integer",
            "description": "Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced."
          },
          "initial_amount": {
            "type": "integer",
            "description": "A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts."
          },
          "price": {
            "type": "integer",
            "description": "Unit price of an item. The value is multiplied by 100 to represent 2 decimal places. For example `10000 cents` for `$100.00`."
          },
          "subtotal_amount": {
            "type": "integer",
            "description": "Final order item amount after the applied item-level discount.  If there are no item-level discounts applied, this item is equal to the `amount`.   \n`subtotal_amount`=`amount`-`applied_discount_amount`"
          },
          "product": {
            "type": "object",
            "description": "An object containing details of the related product.",
            "properties": {
              "id": {
                "type": "string",
                "description": "A unique identifier that represents the product and is assigned by Voucherify."
              },
              "source_id": {
                "type": "string",
                "description": "The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service."
              },
              "override": {
                "type": "boolean",
                "description": "The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system."
              },
              "name": {
                "type": "string",
                "description": "Product name."
              },
              "metadata": {
                "type": "object",
                "description": "A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. It can be used to create product collections."
              },
              "price": {
                "type": "number",
                "description": "Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00)."
              }
            }
          },
          "sku": {
            "type": "object",
            "description": "An object containing details of the related SKU.",
            "properties": {
              "id": {
                "type": "string",
                "description": "A unique identifier that represents the SKU and is assigned by Voucherify."
              },
              "source_id": {
                "type": "string",
                "description": "The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service."
              },
              "override": {
                "type": "boolean",
                "description": "The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system."
              },
              "sku": {
                "type": "string",
                "description": "The SKU name."
              },
              "price": {
                "type": "number",
                "description": "SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00)."
              },
              "metadata": {
                "type": "object",
                "description": "A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. It can be used to create product collections."
              }
            }
          },
          "object": {
            "type": "string",
            "default": "order_item",
            "enum": [
              "order_item"
            ],
            "description": "The type of the object represented by JSON."
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to an item object. It can be useful for storing additional information about the item in a structured format. It can be used to define business validation rules or discount formulas."
          }
        },
        "required": [
          "object"
        ]
      },
      "Order": {
        "title": "Order",
        "type": "object",
        "description": "Order information.",
        "allOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request."
              }
            }
          },
          {
            "$ref": "#/components/schemas/OrderBase"
          }
        ]
      },
      "Customer": {
        "title": "Customer",
        "allOf": [
          {
            "type": "object",
            "title": "Customer Id And Source Id",
            "properties": {
              "id": {
                "type": "string",
                "description": "The ID of an existing customer."
              },
              "source_id": {
                "type": "string",
                "description": "A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored."
              }
            }
          },
          {
            "$ref": "#/components/schemas/CustomerBase"
          }
        ]
      },
      "Referrer": {
        "title": "Referrer",
        "allOf": [
          {
            "$ref": "#/components/schemas/Customer"
          }
        ]
      },
      "OrderBase": {
        "title": "Order Base",
        "type": "object",
        "description": "Order information.",
        "properties": {
          "source_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique source ID of an existing order that will be linked to the redemption of this request.\n\nFor validation and redemption, if `source_id` is used with an existing order, the original order data will be used, like `items`, `amount`, and so on, not the one sent in the new request."
          },
          "status": {
            "type": "string",
            "description": "The order status.",
            "enum": [
              "CREATED",
              "PAID",
              "CANCELED",
              "FULFILLED"
            ]
          },
          "amount": {
            "type": "integer",
            "description": "A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts."
          },
          "initial_amount": {
            "type": "integer",
            "description": "A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts."
          },
          "discount_amount": {
            "type": "integer",
            "description": "Sum of all order-level discounts applied to the order. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00)."
          },
          "items": {
            "type": "array",
            "description": "Array of items applied to the order. It can include up to 500 items.",
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            }
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. It can be used to define business validation rules or discount formulas."
          }
        }
      },
      "AsyncActions": {
        "type": "object",
        "title": "Asynchronous Actions",
        "description": "Response to requests that are processed asynchronously.",
        "properties": {
          "async_action_id": {
            "type": "string",
            "example": "aa_0a875d56c805df6601",
            "description": "The ID of the scheduled asynchronous action."
          }
        },
        "required": [
          "async_action_id"
        ]
      },
      "ExportOrderOrder": {
        "title": "Export Order Order",
        "type": "string",
        "enum": [
          "-created_at",
          "created_at",
          "-updated_at",
          "updated_at",
          "-status",
          "status"
        ]
      },
      "ExportOrderFields": {
        "title": "Export Order Fields",
        "type": "string",
        "enum": [
          "id",
          "source_id",
          "created_at",
          "updated_at",
          "status",
          "amount",
          "discount_amount",
          "items_discount_amount",
          "total_discount_amount",
          "total_amount",
          "customer_id",
          "referrer_id",
          "metadata"
        ]
      },
      "ExportOrderFilters": {
        "title": "Export Order Filters",
        "description": "Allowed additional properties must start with \"metadata.\"",
        "type": "object",
        "properties": {
          "junction": {
            "$ref": "#/components/schemas/Junction"
          },
          "created_at": {
            "type": "object",
            "properties": {
              "conditions": {
                "title": "Filters Condition",
                "type": "object",
                "properties": {
                  "$after": {
                    "$ref": "#/components/schemas/Any"
                  },
                  "$before": {
                    "$ref": "#/components/schemas/Any"
                  }
                }
              }
            }
          },
          "updated_at": {
            "type": "object",
            "properties": {
              "conditions": {
                "title": "Filters Condition",
                "type": "object",
                "properties": {
                  "$after": {
                    "$ref": "#/components/schemas/Any"
                  },
                  "$before": {
                    "$ref": "#/components/schemas/Any"
                  }
                }
              }
            }
          },
          "status": {
            "$ref": "#/components/schemas/FieldConditions"
          },
          "source_id": {
            "$ref": "#/components/schemas/FieldConditions"
          },
          "amount": {
            "$ref": "#/components/schemas/FieldConditions"
          },
          "total_amount": {
            "$ref": "#/components/schemas/FieldConditions"
          },
          "discount_amount": {
            "$ref": "#/components/schemas/FieldConditions"
          },
          "total_discount_amount": {
            "$ref": "#/components/schemas/FieldConditions"
          },
          "items_discount_amount": {
            "$ref": "#/components/schemas/FieldConditions"
          }
        },
        "additionalProperties": {
          "$ref": "#/components/schemas/FieldConditions"
        }
      },
      "ExportScheduledBase": {
        "title": "Export Scheduled Base",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique export ID."
          },
          "object": {
            "type": "string",
            "default": "export",
            "enum": [
              "export"
            ],
            "description": "The type of object being represented. This object stores information about the export."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format."
          },
          "status": {
            "type": "string",
            "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.",
            "default": "SCHEDULED",
            "enum": [
              "SCHEDULED"
            ]
          },
          "channel": {
            "type": "string",
            "description": "The channel through which the export was triggered."
          },
          "result": {
            "type": "object",
            "nullable": true,
            "default": null,
            "description": "Contains the URL of the CSV file."
          },
          "user_id": {
            "type": "string",
            "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE."
          }
        },
        "required": [
          "id",
          "object",
          "created_at",
          "status",
          "result",
          "user_id"
        ]
      },
      "ExportOrderBase": {
        "title": "Export Orders",
        "type": "object",
        "properties": {
          "exported_object": {
            "type": "string",
            "default": "order",
            "enum": [
              "order"
            ],
            "description": "The type of object to be exported."
          },
          "parameters": {
            "type": "object",
            "properties": {
              "order": {
                "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ExportOrderOrder"
                  }
                ]
              },
              "fields": {
                "type": "array",
                "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.",
                "items": {
                  "$ref": "#/components/schemas/ExportOrderFields"
                }
              },
              "filters": {
                "description": "Filter conditions.",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ExportOrderFilters"
                  }
                ]
              }
            },
            "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data."
          }
        },
        "required": [
          "exported_object"
        ]
      },
      "CustomerId": {
        "title": "Customer Id",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A unique identifier of an existing customer."
          },
          "object": {
            "type": "string",
            "description": "The type of the object represented by JSON.",
            "default": "customer",
            "enum": [
              "customer"
            ]
          }
        },
        "required": [
          "id",
          "object"
        ]
      },
      "ReferrerId": {
        "title": "Referrer Id",
        "allOf": [
          {
            "$ref": "#/components/schemas/CustomerId"
          }
        ]
      },
      "OrderRedemptionsEntry": {
        "title": "Order Redemptions",
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format.",
            "example": "2022-09-02T17:06:56.649Z",
            "format": "date-time"
          },
          "rollback_id": {
            "type": "string",
            "description": "Unique ID of the redemption rollback.",
            "example": "rr_0c63c84eb78ee0a6c0"
          },
          "rollback_date": {
            "type": "string",
            "description": "Timestamp representing the date and time when the redemption rollback was created. The value is shown in the ISO 8601 format.",
            "example": "2023-01-31T14:18:37.150Z",
            "format": "date-time"
          },
          "related_object_type": {
            "type": "string",
            "description": "The source of the incentive.",
            "default": "redemption"
          },
          "related_object_id": {
            "type": "string",
            "description": "Unique ID of the parent redemption.",
            "example": "r_0ba186c4824e4881e1"
          },
          "related_object_parent_id": {
            "type": "string",
            "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign."
          },
          "stacked": {
            "type": "array",
            "description": "Contains a list of unique IDs of child redemptions, which belong to the stacked incentives.",
            "items": {
              "type": "string"
            }
          },
          "rollback_stacked": {
            "type": "array",
            "description": "Lists the rollback redemption IDs of the particular child redemptions.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CustomerBase": {
        "title": "Customer Base",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Customer's first and last name."
          },
          "description": {
            "type": "string",
            "description": "An arbitrary string that you can attach to a customer object."
          },
          "email": {
            "type": "string",
            "description": "Customer's email address."
          },
          "phone": {
            "type": "string",
            "description": "Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel."
          },
          "birthday": {
            "type": "string",
            "description": "`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.",
            "format": "date"
          },
          "birthdate": {
            "type": "string",
            "description": "Customer's birthdate; format YYYY-MM-DD.",
            "format": "date"
          },
          "address": {
            "type": "object",
            "nullable": true,
            "description": "Customer's address.",
            "properties": {
              "city": {
                "type": "string",
                "description": "City"
              },
              "state": {
                "type": "string",
                "description": "State"
              },
              "line_1": {
                "type": "string",
                "description": "First line of address."
              },
              "line_2": {
                "type": "string",
                "description": "Second line of address."
              },
              "country": {
                "type": "string",
                "description": "Country."
              },
              "postal_code": {
                "type": "string",
                "description": "Postal code."
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments."
          }
        }
      },
      "OrderItem": {
        "type": "object",
        "title": "Order Item",
        "properties": {
          "sku_id": {
            "type": "string",
            "description": "Unique identifier of the SKU. It is assigned by Voucherify."
          },
          "product_id": {
            "type": "string",
            "description": "Unique identifier of the product. It is assigned by Voucherify."
          },
          "related_object": {
            "type": "string",
            "enum": [
              "product",
              "sku"
            ],
            "description": "Used along with the source_id property, can be set to either sku or product."
          },
          "source_id": {
            "type": "string",
            "description": "The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service."
          },
          "quantity": {
            "type": "integer",
            "description": "The quantity of the particular item in the cart."
          },
          "discount_quantity": {
            "type": "integer",
            "description": "Number of dicounted items."
          },
          "initial_quantity": {
            "type": "integer",
            "description": "A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity."
          },
          "amount": {
            "type": "integer",
            "description": "The total amount of the order item (price * quantity)."
          },
          "discount_amount": {
            "type": "integer",
            "description": "Sum of all order-item-level discounts applied to the order."
          },
          "initial_amount": {
            "type": "integer",
            "description": "A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts."
          },
          "price": {
            "type": "integer",
            "description": "Unit price of an item. The value is multiplied by 100 to represent 2 decimal places. For example `10000 cents` for `$100.00`."
          },
          "product": {
            "type": "object",
            "description": "An object containing details of the related product.",
            "properties": {
              "id": {
                "type": "string",
                "description": "A unique identifier that represents the product and is assigned by Voucherify."
              },
              "source_id": {
                "type": "string",
                "description": "The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service."
              },
              "override": {
                "type": "boolean",
                "description": "The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. Override works only for endpoints that create an order in the database."
              },
              "name": {
                "type": "string",
                "description": "Product name."
              },
              "metadata": {
                "type": "object",
                "description": "A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. It can be used to create product collections."
              },
              "price": {
                "type": "number",
                "description": "Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00)."
              }
            }
          },
          "sku": {
            "type": "object",
            "description": "An object containing details of the related SKU.",
            "properties": {
              "id": {
                "type": "string",
                "description": "A unique identifier that represents the SKU and is assigned by Voucherify."
              },
              "source_id": {
                "type": "string",
                "description": "The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service."
              },
              "override": {
                "type": "boolean",
                "description": "The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system."
              },
              "sku": {
                "type": "string",
                "description": "The SKU name."
              },
              "price": {
                "type": "number",
                "description": "SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00)."
              },
              "metadata": {
                "type": "object",
                "description": "A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format. It can be used to create product collections."
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format. It can be used to define business validation rules."
          }
        },
        "required": [
          "object"
        ]
      },
      "Junction": {
        "title": "Junction",
        "description": "Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while  an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE.",
        "enum": [
          "and",
          "or"
        ],
        "type": "string"
      },
      "Any": {
        "title": "Any",
        "type": "array",
        "items": {
          "oneOf": [
            {
              "title": "string",
              "type": "string"
            },
            {
              "title": "string - date",
              "type": "string",
              "format": "date"
            },
            {
              "title": "string - date-time",
              "type": "string",
              "format": "date-time"
            },
            {
              "title": "number",
              "type": "number"
            },
            {
              "title": "object",
              "type": "object"
            }
          ]
        }
      },
      "FieldConditions": {
        "title": "Field Conditions",
        "type": "object",
        "properties": {
          "conditions": {
            "description": "Data filters used to narrow down the data records to be returned in the result.",
            "allOf": [
              {
                "$ref": "#/components/schemas/FiltersCondition"
              }
            ]
          }
        }
      },
      "FiltersCondition": {
        "title": "Filters Condition",
        "type": "object",
        "properties": {
          "$in": {
            "$ref": "#/components/schemas/Any"
          },
          "$not_in": {
            "$ref": "#/components/schemas/Any"
          },
          "$is": {
            "$ref": "#/components/schemas/Any"
          },
          "$is_days_ago": {
            "$ref": "#/components/schemas/Any"
          },
          "$is_days_in_future": {
            "$ref": "#/components/schemas/Any"
          },
          "$is_not": {
            "$ref": "#/components/schemas/Any"
          },
          "$has_value": {
            "$ref": "#/components/schemas/Any"
          },
          "$is_unknown": {
            "$ref": "#/components/schemas/Any"
          },
          "$contains": {
            "$ref": "#/components/schemas/Any"
          },
          "$not_contain": {
            "$ref": "#/components/schemas/Any"
          },
          "$starts_with": {
            "$ref": "#/components/schemas/Any"
          },
          "$ends_with": {
            "$ref": "#/components/schemas/Any"
          },
          "$more_than": {
            "$ref": "#/components/schemas/Any"
          },
          "$less_than": {
            "$ref": "#/components/schemas/Any"
          },
          "$more_than_ago": {
            "$ref": "#/components/schemas/Any"
          },
          "$less_than_ago": {
            "$ref": "#/components/schemas/Any"
          },
          "$more_than_future": {
            "$ref": "#/components/schemas/Any"
          },
          "$less_than_future": {
            "$ref": "#/components/schemas/Any"
          },
          "$more_than_equal": {
            "$ref": "#/components/schemas/Any"
          },
          "$less_than_equal": {
            "$ref": "#/components/schemas/Any"
          },
          "$after": {
            "$ref": "#/components/schemas/Any"
          },
          "$before": {
            "$ref": "#/components/schemas/Any"
          },
          "$count": {
            "$ref": "#/components/schemas/Any"
          },
          "$count_less": {
            "$ref": "#/components/schemas/Any"
          },
          "$count_more": {
            "$ref": "#/components/schemas/Any"
          }
        }
      }
    },
    "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`."
            }
          }
        }
      }
    }
  }
}