# Request Token

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

#### Method

```

POST https://prod.ninjapay.me/lapi/v1/requestToken

```

#### Parameters

```javascript
Body (application/json)
{
  widget_mode: string, // Add "onramp" for receiving or "offramp" for withdrawing.
  amount: number, // The amount in BTC(not SAT)
  order_id?: string; // Optional From title for voucher giveaway
  callback_url?: string, // Add this if you want a success response upon 
}

```

#### Other info

| Parameters    | Input options        |
| ------------- | -------------------- |
| `widget_mode` | `onramp` , `offramp` |

#### Response

```jsx

{
  "token": 198660213997
}

```

#### Code Example

```jsx

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

fetch('https://prod.ninjapay.me/lapi/v1/requestToken', 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/coming-soon/widget-integration/request-token.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.
