> 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.md).

# Vouchers

## Vauchar API: Vouchers

*A guide to creating, managing, and retrieving voucher resources with the Vauchar REST API.*

The Vauchar API provides a complete, RESTful interface for integrating voucher functionality into your application. This document focuses specifically on creating and managing **Voucher** resources.

A Voucher is the core object representing a single-use or multi-use code with a specific value. You can create new vouchers, retrieve lists of all available vouchers, or fetch individual ones by their unique ID.

#### Quickstart Info

* **Architecture:** RESTful
* **Response Format:** JSON
* **Authentication:** HTTP Basic Auth
* **Base URL:** `https://api.vauchar.com`

#### Authentication

All requests must be authenticated using **HTTP Basic Authentication**. The API expects an `Authorization` header containing a Base64 encoded string of your `<Your_Merchant_Id>:<Your_Api_Key>`.

#### The Voucher Object

When you retrieve voucher information, you will receive a Voucher object with the following attributes:

| Attribute       | Type    | Description                                                                   |
| --------------- | ------- | ----------------------------------------------------------------------------- |
| `id`            | string  | The unique identifier for the voucher.                                        |
| `voucher_code`  | string  | The code for the voucher.                                                     |
| `redeemed`      | integer | Indicates if the voucher has been redeemed (1 for true, 0 for false).         |
| `value`         | string  | The value of the voucher.                                                     |
| `value_unit`    | string  | The unit of the voucher's value (e.g., 'fixed', 'percentage').                |
| `currency`      | string  | The currency of the voucher's value (e.g., 'USD').                            |
| `start_time`    | integer | The timestamp when the voucher becomes valid (Unix timestamp).                |
| `expiry_time`   | integer | The timestamp when the voucher expires (Unix timestamp). `0` means no expiry. |
| `created`       | integer | The timestamp when the voucher was created (Unix timestamp).                  |
| `redeemed_date` | integer | The timestamp when the voucher was redeemed. Null if not redeemed.            |
| `tag`           | string  | A custom tag associated with the voucher for tracking or grouping.            |
| `href`          | string  | The direct URL to this specific voucher resource.                             |
