# Request Voucher

Create a withdraw voucher request to be redeemed by anyone. Money will be deducted from your lightning wallet.

#### Method

```

POST https://api.ninjapay.me/lapi/v1/requestVoucher

```

#### Parameters

```javascript
Body (application/json)
{
  amount: number, // The amount in BTC(not SAT) per voucher
  voucher_count: number; // Number of vouhers required (1min - 100max)
  from?: string; // Optional From title for voucher giveaway
  title?: string; // Title/message of the voucher 
  expiry?: number; // Optional voucher expiry in mins
  receiver_email?: string, // Add this email ID if you want to send the voucher to an email. Note: voucher_count has to be one for email trigger!
  unique_design?: bool, // Add "true" if you want to use your own custom design for voucher.
  unique_design_url?: string, // Custom voucher design url in 640x360px(16:9) in size.
  callback_url?: string, // Add this if you want a success response upon 
}

```

#### Response

<pre class="language-jsx"><code class="lang-jsx">{
  "status": true,
<strong>    "data": {
</strong>        "tid": "19M86602AN139N97", 
        "created_at": 1414912921,
        "expires_at": 1714912921,
        "voucher_count": 2,
        "voucher_redeemed": 1,
        "amount": 0.00001000, // amount/voucher in BTC
        "from": "Swiggy",
        "title": "Congrats IPL Spinwheel winner",
        "receiver_email": null, // Note: voucher_count has to be one for email trigger!
        "email_status": "undefined", // "success", "pending", "undefined" status's
        "unique_design": true,
        "unique_design_url": "https://www.mycompanydesignin600x900pixel.com",
        "callback_url": "https://yourwebhook.com",
        "voucher_static_url": "https://www.ninjapay.me/voucher/198660213997", // This single multi use url can be used to redeem all vouchers.
        "voucher_urls": [
               {
                "voucher_url": "https://www.ninjapay.me/voucher/redeem/7ee15185"
               },
               {
                "voucher_url": "https://www.ninjapay.me/voucher/redeem/39e11981h",
               },
          ]
      },
     "message": "", 
}

</code></pre>

Note: By default for static voucher url's, a ninjapay user(@username) can redeem only once. This will avoid ass-milking.&#x20;

#### Webhook Response

```json

{
  "tid":"1986B6021A3N997",
  "voucher_url": "https://www.ninjapay.me/voucher/redeem/7ee15185",
  "redeemed_by": "ninjatagUsername", // @ninjatag(ninjapay username) or invoice(lnbc..ndjj)
  "redeemed_tid": 128660213994,
}
```

#### Code Example

```jsx

const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY' //Admin key required
  },
  body: '{"amount":0.00180204,"voucher_count":1,"title":"Happy Birthday🥳"}'
};

fetch('https://api.ninjapay.me/lapi/v1/requestVoucher', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  
```


---

# 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://ninjapay.gitbook.io/ninjapay-api-docs/how-to/api-reference-btc/withdraw-vouchers/request-voucher.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.
