---
title: Validate a voucher
slug: docs/demo/validate-a-voucher
description: Learn how to use cURL to make a precise GET request to an API endpoint with this comprehensive code example. Discover the exact syntax, including the URL, request type, headers, and body format, to effortlessly fetch the desired data. Improve your coding 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "J_vyfG1ZbfsXaGcEPXvHF",
  "data": {
    "url": "https://api.fictive.com/REST/api/vouchers/{voucherCode}/validate",
    "name": "Validate a voucher",
    "method": "GET",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "voucherCode",
          "type": "string"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "paymentDatesToCalculate",
          "type": "integer"
        },
        {
          "kind": "optional",
          "name": "paymentDatesStartDate",
          "type": "string"
        },
        {
          "kind": "optional",
          "name": "clientUserId",
          "type": "string"
        }
      ],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "X-TokenId",
          "type": "string",
          "description": "The eSuite Token Id"
        },
        {
          "kind": "optional",
          "name": "X-SessionId",
          "type": "string",
          "description": "The eSuite Session Id"
        },
        {
          "kind": "required",
          "name": "X-Version",
          "type": "string",
          "description": "The eSuite Version"
        },
        {
          "kind": "optional",
          "name": "Origin",
          "type": "string",
          "description": "The eSuite Origin"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "purchaseInfo",
                "type": "object",
                "schema": [
                  {
                    "kind": "optional",
                    "name": "purchasePrice",
                    "type": "number<double>",
                    "example": "",
                    "description": "Purchase price"
                  },
                  {
                    "kind": "optional",
                    "name": "discountPrice",
                    "type": "number<double>",
                    "example": "",
                    "description": "Discount price"
                  },
                  {
                    "kind": "optional",
                    "name": "renewalPrice",
                    "type": "number<double>",
                    "example": "",
                    "description": "Renewal price"
                  },
                  {
                    "kind": "optional",
                    "name": "nextPaymentsDates",
                    "type": "array",
                    "example": [],
                    "itemType": "string",
                    "customType": "string[]",
                    "description": "Next payments dates",
                    "itemExample": "2021-09-21T05:33:26.5730532"
                  }
                ],
                "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.VoucherPurchaseInfo",
                "customType": "FictiveGlobal.Api.Rest.Dtos.v1.VoucherPurchaseInfo",
                "description": "Purchase info"
              },
              {
                "kind": "optional",
                "name": "voucherInfo",
                "type": "object",
                "schema": [
                  {
                    "kind": "optional",
                    "name": "startDate",
                    "type": "string<date-time>",
                    "example": "2021-09-21T05:33:26.6043032",
                    "description": "Start date"
                  },
                  {
                    "kind": "optional",
                    "name": "expiryDate",
                    "type": "string<date-time>",
                    "example": "2021-09-21T05:33:26.6043032",
                    "description": "Expiry date"
                  },
                  {
                    "kind": "optional",
                    "name": "offerInfo",
                    "type": "object",
                    "schema": [
                      {
                        "kind": "optional",
                        "name": "name",
                        "type": "string",
                        "example": "",
                        "description": "Gets or sets the Name."
                      },
                      {
                        "kind": "optional",
                        "name": "description",
                        "type": "string",
                        "example": "",
                        "description": "Gets or sets the Description."
                      },
                      {
                        "kind": "optional",
                        "name": "usageType",
                        "type": "integer<int32>",
                        "example": 0,
                        "description": "Gets or sets the UsageType."
                      },
                      {
                        "kind": "optional",
                        "name": "applicationData",
                        "type": "object",
                        "schema": [
                          {
                            "kind": "optional",
                            "name": "name",
                            "type": "string",
                            "example": "",
                            "description": "Gets or sets the Name."
                          },
                          {
                            "kind": "optional",
                            "name": "message",
                            "type": "string",
                            "example": "",
                            "description": "Gets or sets the Message."
                          },
                          {
                            "kind": "optional",
                            "name": "message2",
                            "type": "string",
                            "example": "",
                            "description": "Gets or sets the Message2."
                          }
                        ],
                        "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.ApplicationData",
                        "customType": "FictiveGlobal.Api.Rest.Dtos.v1.ApplicationData",
                        "description": "Gets or sets the ApplicationData."
                      },
                      {
                        "kind": "optional",
                        "name": "addCredits",
                        "type": "object",
                        "schema": [
                          {
                            "kind": "optional",
                            "name": "amount",
                            "type": "integer<int32>",
                            "example": 0,
                            "description": "Gets or sets the Amount."
                          },
                          {
                            "kind": "optional",
                            "name": "currency",
                            "type": "string",
                            "example": "",
                            "description": "Gets or sets the Currency."
                          },
                          {
                            "kind": "optional",
                            "name": "paymentDetailsRequired",
                            "type": "boolean",
                            "example": "",
                            "description": "Gets or sets the PaymentDetailsRequired."
                          }
                        ],
                        "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.AddCredits",
                        "customType": "FictiveGlobal.Api.Rest.Dtos.v1.AddCredits",
                        "description": "Gets or sets the AddCredits."
                      },
                      {
                        "kind": "optional",
                        "name": "lowStart",
                        "type": "object",
                        "schema": [
                          {
                            "kind": "optional",
                            "name": "percentage",
                            "type": "number<double>",
                            "example": "",
                            "description": "Gets or sets the Percentage."
                          },
                          {
                            "kind": "optional",
                            "name": "numberOfPeriods",
                            "type": "integer<int32>",
                            "example": 0,
                            "description": "Gets or sets the NumberOfPeriods."
                          },
                          {
                            "kind": "optional",
                            "name": "lockInPeriods",
                            "type": "integer<int32>",
                            "example": 0,
                            "description": "Gets or sets the lockInPeriods."
                          },
                          {
                            "kind": "optional",
                            "name": "closeSubOnExpiry",
                            "type": "boolean",
                            "example": "",
                            "description": "Gets or sets the CloseSubOnExpiry."
                          },
                          {
                            "kind": "optional",
                            "name": "serviceIds",
                            "type": "array",
                            "example": [],
                            "itemType": "integer",
                            "customType": "integer[]",
                            "description": "Gets or sets the ServiceIds.",
                            "itemExample": ""
                          },
                          {
                            "kind": "optional",
                            "name": "paymentDetailsRequired",
                            "type": "boolean",
                            "example": "",
                            "description": "Gets or sets the PaymentDetailsRequired."
                          }
                        ],
                        "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.LowStart",
                        "customType": "FictiveGlobal.Api.Rest.Dtos.v1.LowStart",
                        "description": "Gets or sets the LowStart."
                      },
                      {
                        "kind": "optional",
                        "name": "percentageDiscount",
                        "type": "object",
                        "schema": [
                          {
                            "kind": "optional",
                            "name": "percentage",
                            "type": "number<double>",
                            "example": "",
                            "description": "Gets or sets the Percentage."
                          },
                          {
                            "kind": "optional",
                            "name": "paymentDetailsRequired",
                            "type": "boolean",
                            "example": "",
                            "description": "Gets or sets the PaymentDetailsRequired."
                          },
                          {
                            "kind": "optional",
                            "name": "productIds",
                            "type": "array",
                            "example": [],
                            "itemType": "integer",
                            "customType": "integer[]",
                            "description": "Gets or sets the Products Ids.",
                            "itemExample": ""
                          }
                        ],
                        "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PercentageDiscount",
                        "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PercentageDiscount",
                        "description": "Gets or sets the PercentageDiscount"
                      },
                      {
                        "kind": "optional",
                        "name": "freePeriod",
                        "type": "object",
                        "schema": [
                          {
                            "kind": "optional",
                            "name": "numberOfPeriods",
                            "type": "integer<int32>",
                            "example": 0,
                            "description": "Gets or sets the NumberOfPeriods."
                          },
                          {
                            "kind": "optional",
                            "name": "serviceIds",
                            "type": "array",
                            "example": [],
                            "itemType": "integer",
                            "customType": "integer[]",
                            "description": "Gets or sets the ServiceIds.",
                            "itemExample": ""
                          },
                          {
                            "kind": "optional",
                            "name": "paymentDetailsRequired",
                            "type": "boolean",
                            "example": "",
                            "description": "Gets or sets the PaymentDetailsRequired."
                          }
                        ],
                        "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.FreePeriod",
                        "customType": "FictiveGlobal.Api.Rest.Dtos.v1.FreePeriod",
                        "description": "Gets or sets the FreePeriod"
                      },
                      {
                        "kind": "optional",
                        "name": "groupDiscount",
                        "type": "object",
                        "schema": [
                          {
                            "kind": "optional",
                            "name": "activationCodeActivated",
                            "type": "boolean",
                            "example": "",
                            "description": "Activation code activated"
                          },
                          {
                            "kind": "optional",
                            "name": "metaData",
                            "type": "object",
                            "schema": [
                              {
                                "kind": "optional",
                                "name": "qualifyingItemCount",
                                "type": "integer<int32>",
                                "example": 0,
                                "description": "Qualifying item count"
                              },
                              {
                                "kind": "optional",
                                "name": "freeItemCountOrDiscountAmount",
                                "type": "number<double>",
                                "example": "",
                                "description": "Free item count or discount amount"
                              },
                              {
                                "kind": "optional",
                                "name": "productIds",
                                "type": "array",
                                "example": [],
                                "itemType": "integer",
                                "customType": "integer[]",
                                "description": "Product ids",
                                "itemExample": ""
                              },
                              {
                                "kind": "optional",
                                "name": "configurationType",
                                "type": "string",
                                "example": "",
                                "description": "Configuration type"
                              },
                              {
                                "kind": "optional",
                                "name": "productSource",
                                "type": "string",
                                "example": "",
                                "description": "Product source"
                              },
                              {
                                "kind": "optional",
                                "name": "customParameters",
                                "type": "object",
                                "schema": [],
                                "example": {},
                                "description": "Custom parameters"
                              }
                            ],
                            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.GroupDiscountOfferType",
                            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.GroupDiscountOfferType",
                            "description": "Meta data"
                          }
                        ],
                        "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.GroupDiscount",
                        "customType": "FictiveGlobal.Api.Rest.Dtos.v1.GroupDiscount",
                        "description": "Gets or sets the GroupDiscount"
                      },
                      {
                        "kind": "optional",
                        "name": "fixedPriceDiscount",
                        "type": "object",
                        "schema": [
                          {
                            "kind": "optional",
                            "name": "discountAmounts",
                            "type": "array",
                            "schema": [
                              {
                                "kind": "optional",
                                "name": "value",
                                "type": "number<double>",
                                "example": "",
                                "description": "Discount value."
                              },
                              {
                                "kind": "optional",
                                "name": "currency",
                                "type": "string",
                                "example": "",
                                "description": "Currency for the discount value."
                              }
                            ],
                            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Offers.DiscountAmount",
                            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Offers.DiscountAmount[]",
                            "description": "The discount amounts associated to the fixed price discount."
                          },
                          {
                            "kind": "optional",
                            "name": "paymentDetailsRequired",
                            "type": "boolean",
                            "example": "",
                            "description": "Value that indicates if payment details are required."
                          },
                          {
                            "kind": "optional",
                            "name": "subscriptionSettings",
                            "type": "object",
                            "schema": [
                              {
                                "kind": "optional",
                                "name": "enabled",
                                "type": "boolean",
                                "example": "",
                                "description": "Value that indicates if subscriptions are enabled."
                              },
                              {
                                "kind": "optional",
                                "name": "numberOfPeriods",
                                "type": "integer<int32>",
                                "example": 0,
                                "description": "The number of periods the offer applies to."
                              },
                              {
                                "kind": "optional",
                                "name": "lockInPeriods",
                                "type": "integer<int32>",
                                "example": 0,
                                "description": "The number of lock in periods of the offer."
                              },
                              {
                                "kind": "optional",
                                "name": "closeSubOnExpiry",
                                "type": "boolean",
                                "example": "",
                                "description": "Value that indicates if the subscription should close on expiry."
                              },
                              {
                                "kind": "optional",
                                "name": "serviceIds",
                                "type": "array",
                                "example": [],
                                "itemType": "integer",
                                "customType": "integer[]",
                                "description": "The services that the offer will apply to.",
                                "itemExample": ""
                              }
                            ],
                            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Offers.SubscriptionSettings",
                            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Offers.SubscriptionSettings",
                            "description": "Subscription settings."
                          },
                          {
                            "kind": "optional",
                            "name": "productSettings",
                            "type": "object",
                            "schema": [
                              {
                                "kind": "optional",
                                "name": "enabled",
                                "type": "boolean",
                                "example": "",
                                "description": "Value that indicates if products are enabled."
                              },
                              {
                                "kind": "optional",
                                "name": "productIds",
                                "type": "array",
                                "example": [],
                                "itemType": "integer",
                                "customType": "integer[]",
                                "description": "The products that the offer will apply to.",
                                "itemExample": ""
                              }
                            ],
                            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Offers.ProductSettings",
                            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Offers.ProductSettings",
                            "description": "Product settings."
                          },
                          {
                            "kind": "optional",
                            "name": "miscellaneousChargeSettings",
                            "type": "object",
                            "schema": [
                              {
                                "kind": "optional",
                                "name": "enabled",
                                "type": "boolean",
                                "example": "",
                                "description": "/// Value that indicates if the offer was enabled for miscellaneous charge."
                              }
                            ],
                            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Offers.MiscellaneousChargeSettings",
                            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Offers.MiscellaneousChargeSettings",
                            "description": "Miscellaneous charge settings."
                          }
                        ],
                        "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.FixedPriceDiscount",
                        "customType": "FictiveGlobal.Api.Rest.Dtos.v1.FixedPriceDiscount",
                        "description": "Gets or sets the FixedPriceDiscount"
                      }
                    ],
                    "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.VoucherOfferInfo",
                    "customType": "FictiveGlobal.Api.Rest.Dtos.v1.VoucherOfferInfo",
                    "description": "Offer info"
                  }
                ],
                "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.VoucherInfo",
                "customType": "FictiveGlobal.Api.Rest.Dtos.v1.VoucherInfo",
                "description": "Voucher info"
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Voucher",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Voucher",
            "isExpanded": true,
            "description": "Voucher"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "OK",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "Not Authorized",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "403",
        "description": "Offer is not for this affiate/account.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to validate a voucher against the specific purchase the account is attempting to make",
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.fictive.com/REST/api/vouchers/{voucherCode}/validate \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-version\", \"string\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/vouchers/{voucherCode}/validate\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/vouchers/{voucherCode}/validate\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-version\"] = \"string\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/vouchers/{voucherCode}/validate\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n{\n  \"purchaseInfo\": {\n    \"purchasePrice\": \"\",\n    \"discountPrice\": \"\",\n    \"renewalPrice\": \"\",\n    \"nextPaymentsDates\": [\n      \"2021-09-21T05:33:26.5730532\"\n    ]\n  },\n  \"voucherInfo\": {\n    \"startDate\": \"2021-09-21T05:33:26.6043032\",\n    \"expiryDate\": \"2021-09-21T05:33:26.6043032\",\n    \"offerInfo\": {\n      \"name\": \"\",\n      \"description\": \"\",\n      \"usageType\": \"\",\n      \"applicationData\": {\n        \"name\": \"\",\n        \"message\": \"\",\n        \"message2\": \"\"\n      },\n      \"addCredits\": {\n        \"amount\": \"\",\n        \"currency\": \"\",\n        \"paymentDetailsRequired\": false\n      },\n      \"lowStart\": {\n        \"percentage\": \"\",\n        \"numberOfPeriods\": \"\",\n        \"lockInPeriods\": \"\",\n        \"closeSubOnExpiry\": false,\n        \"serviceIds\": [\n          0\n        ],\n        \"paymentDetailsRequired\": false\n      },\n      \"percentageDiscount\": {\n        \"percentage\": \"\",\n        \"paymentDetailsRequired\": false,\n        \"productIds\": [\n          0\n        ]\n      },\n      \"freePeriod\": {\n        \"numberOfPeriods\": \"\",\n        \"serviceIds\": [\n          0\n        ],\n        \"paymentDetailsRequired\": false\n      },\n      \"groupDiscount\": {\n        \"activationCodeActivated\": false,\n        \"metaData\": {\n          \"qualifyingItemCount\": \"\",\n          \"freeItemCountOrDiscountAmount\": \"\",\n          \"productIds\": [\n            0\n          ],\n          \"configurationType\": \"\",\n          \"productSource\": \"\",\n          \"customParameters\": {}\n        }\n      },\n      \"fixedPriceDiscount\": {\n        \"discountAmounts\": [\n          {\n            \"value\": \"\",\n            \"currency\": \"\"\n          }\n        ],\n        \"paymentDetailsRequired\": false,\n        \"subscriptionSettings\": {\n          \"enabled\": false,\n          \"numberOfPeriods\": \"\",\n          \"lockInPeriods\": \"\",\n          \"closeSubOnExpiry\": false,\n          \"serviceIds\": [\n            0\n          ]\n        },\n        \"productSettings\": {\n          \"enabled\": false,\n          \"productIds\": [\n            0\n          ]\n        },\n        \"miscellaneousChargeSettings\": {\n          \"enabled\": false\n        }\n      }\n    }\n  }\n}"
        },
        {
          "id": "response-1-401",
          "language": "401",
          "code": "// Not Authorized\n"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Offer is not for this affiate/account.\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}