> For the complete documentation index, see [llms.txt](https://vauchar.gitbook.io/vauchar/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vauchar.gitbook.io/vauchar/api-references/vouchers/voucher-validations.md).

# Voucher Validations

Operations related to validating voucher codes.

## Validate a Voucher by Code

> Checks the validity of a voucher code and returns its details if valid.

```json
{"openapi":"3.0.3","info":{"title":"Vauchar API","version":"1.0.0"},"tags":[{"name":"Voucher Validations","description":"Operations related to validating voucher codes."}],"servers":[{"url":"https://api.vauchar.com","description":"Production Server"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"Basic Authentication using Merchant ID as username and API Key as password."}},"schemas":{"VoucherValidationResponse":{"type":"object","properties":{"validation_status":{"$ref":"#/components/schemas/ValidationStatus"},"data":{"$ref":"#/components/schemas/Voucher"}}},"ValidationStatus":{"type":"object","properties":{"status":{"type":"integer","description":"A status code indicating the validation result."},"message":{"type":"string","description":"A descriptive message about the validation status."}}},"Voucher":{"type":"object","properties":{"href":{"type":"string","format":"uri","description":"The unique URI for the voucher resource."},"type":{"type":"string","description":"The type of the object."},"id":{"type":"string","description":"The unique identifier for the voucher."},"voucher_code":{"type":"string","description":"The code for the voucher."},"tag":{"type":"string","description":"A tag associated with the voucher."},"created":{"type":"integer","format":"int64","description":"The timestamp when the voucher was created."},"start_time":{"type":"integer","format":"int64","description":"The timestamp when the voucher becomes valid."},"expiry_time":{"type":"integer","format":"int64","description":"The timestamp when the voucher expires."},"value":{"type":"string","description":"The value of the voucher."},"value_unit":{"type":"string","description":"The unit of the voucher's value.","enum":["percentage","fixed"]},"currency":{"type":"string","description":"The currency of the voucher's value."},"redeemed":{"type":"integer","description":"Indicates if the voucher has been redeemed (1 for true, 0 for false)."},"redeemed_date":{"type":"integer","format":"int64","nullable":true,"description":"The timestamp when the voucher was redeemed."},"teams":{"type":"array","items":{"type":"string"},"description":"A list of teams associated with the voucher."},"brands":{"type":"array","items":{"type":"string"},"description":"A list of brands associated with the voucher."}}}}},"paths":{"/vouchers/validate":{"get":{"summary":"Validate a Voucher by Code","description":"Checks the validity of a voucher code and returns its details if valid.","tags":["Voucher Validations"],"operationId":"validateVoucherByCode","parameters":[{"name":"voucher_code","in":"query","required":true,"description":"The voucher code to validate.","schema":{"type":"string"}}],"responses":{"200":{"description":"Voucher validation status and details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoucherValidationResponse"}}}},"401":{"description":"Unauthorized. The API key or Merchant ID is invalid or missing."},"404":{"description":"Voucher code not found or is invalid."},"500":{"description":"Internal Server Error."}}}}}}
```

## Validate a Voucher by ID

> Checks the validity of a specific voucher by its ID.

```json
{"openapi":"3.0.3","info":{"title":"Vauchar API","version":"1.0.0"},"tags":[{"name":"Voucher Validations","description":"Operations related to validating voucher codes."}],"servers":[{"url":"https://api.vauchar.com","description":"Production Server"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"Basic Authentication using Merchant ID as username and API Key as password."}},"schemas":{"VoucherValidationResponse":{"type":"object","properties":{"validation_status":{"$ref":"#/components/schemas/ValidationStatus"},"data":{"$ref":"#/components/schemas/Voucher"}}},"ValidationStatus":{"type":"object","properties":{"status":{"type":"integer","description":"A status code indicating the validation result."},"message":{"type":"string","description":"A descriptive message about the validation status."}}},"Voucher":{"type":"object","properties":{"href":{"type":"string","format":"uri","description":"The unique URI for the voucher resource."},"type":{"type":"string","description":"The type of the object."},"id":{"type":"string","description":"The unique identifier for the voucher."},"voucher_code":{"type":"string","description":"The code for the voucher."},"tag":{"type":"string","description":"A tag associated with the voucher."},"created":{"type":"integer","format":"int64","description":"The timestamp when the voucher was created."},"start_time":{"type":"integer","format":"int64","description":"The timestamp when the voucher becomes valid."},"expiry_time":{"type":"integer","format":"int64","description":"The timestamp when the voucher expires."},"value":{"type":"string","description":"The value of the voucher."},"value_unit":{"type":"string","description":"The unit of the voucher's value.","enum":["percentage","fixed"]},"currency":{"type":"string","description":"The currency of the voucher's value."},"redeemed":{"type":"integer","description":"Indicates if the voucher has been redeemed (1 for true, 0 for false)."},"redeemed_date":{"type":"integer","format":"int64","nullable":true,"description":"The timestamp when the voucher was redeemed."},"teams":{"type":"array","items":{"type":"string"},"description":"A list of teams associated with the voucher."},"brands":{"type":"array","items":{"type":"string"},"description":"A list of brands associated with the voucher."}}}}},"paths":{"/vouchers/{voucherId}/validate":{"get":{"summary":"Validate a Voucher by ID","description":"Checks the validity of a specific voucher by its ID.","tags":["Voucher Validations"],"operationId":"validateVoucherById","parameters":[{"name":"voucherId","in":"path","required":true,"description":"The ID of the voucher to validate.","schema":{"type":"string"}}],"responses":{"200":{"description":"Voucher validation status and details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoucherValidationResponse"}}}},"401":{"description":"Unauthorized. The API key or Merchant ID is invalid or missing."},"404":{"description":"Voucher not found."},"500":{"description":"Internal Server Error."}}}}}}
```
