# Create Wallet

{% hint style="info" %}
**API Endpoint**

**POST** [**/client/wallets/save**](https://xpay.stream/client/wallets/save)
{% endhint %}

***

{% hint style="info" %}
**Request Headers:**

Authorization: Bearer [\<access\_token>](/authentication-api.md)

Content-Type: application/json\
\
**Request Body:**

{% code lineNumbers="true" %}

```json
{
    "tag" : "<optional_your_tag>",
    "lightning": "on"// for BTC lightning, else for TRON
}
```

{% endcode %}
{% endhint %}

{% hint style="success" %}
**Success Response**\
You will get under the created wallet details under th&#x65;*`success.data`*

Wallet Address: *`success.data.address.base58`*

Wallet Identifier: *`success.data.uuid`*

**`Sample Below:`**

{% code lineNumbers="true" fullWidth="true" %}

```json
{
    "success": {
        "message": "Wallet Saved",
        "data": {
            "address": {
                "base58": "TYViWxHG5wgnnmCMfVfwTvp3KGkRt4qk7V",
                "hex": "41F717E263E541FDB3C69F7F5062D0573EFF8A9760"
            },
            "username": "<your_email>",
            "uuid": "dd249743-22a3-42fb-8d86-3e27287272e2",
            "createdAt": 1697182976392,
            "tag": "<optional_your_tag>",
            "balances": {
                "tokenBalanceRaw": 0,
                "tokenBalance": 0,
                "tronBalanceSun": 0,
                "tronBalance": 0
            }
        }
    },
    "uuid": "7ac71a3c-7aa2-440c-a379-bcf416fd74e9"
}
```

{% endcode %}
{% endhint %}

***

{% tabs %}
{% tab title="CURL Example" %}
{% code lineNumbers="true" fullWidth="true" %}

```bash
curl 'https://apis.xpay.stream/client/wallets/save' \
  -H 'Content-Type: application/json'               \
  -H 'Authorization: Bearer <access_token>'         \
  --data-raw '{"tag":"<your_tag>"}'              
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS Example" %}
{% code lineNumbers="true" %}

```javascript
// npm i cross-fetch
const fetch = require("cross-fetch");

const API_URL = "https://apis.xpay.stream/client/wallets/save";

const method = "POST";

const headers = { 
    "Content-Type": "application/json",
    "Authorization": "Bearer <access_token>"
};

const body = JSON.stringify({ 
    tag: "<your_tag>",
    lightning: "on" // for BTC Lightning or off for TRON 
});

fetch(API_URL, { headers, body, method })
.then(async res =>  await res.json())
.then(result => {
    if(result.error)
        console.log("Wallet Creation Error", result);
    if(result.success)
        console.log("Wallet Created", result);
})
.catch((err) => {
    console.error("Wallet Create API Exception", err);
});
```

{% endcode %}

{% endtab %}
{% endtabs %}


---

# 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://docs.xpay.stream/wallets/create-wallet.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.
