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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vauchar.gitbook.io/vauchar/api-references/vouchers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
