# Create a new wallet

## Create a new wallet

<mark style="color:green;">`POST`</mark> `/generate_wallet/create_wallet`

This endpoint generates a new wallet for the user. Upon creation, a new wallet address and private key are generated. This endpoint requires the email of the user and network on which the account needs to be created for wallet creation and x-api-key and Lync's API key for request validation and it will return a newly created wallet's details, including the wallet address and private key. It's recommended to securely store the private key since it is required to access and manage the wallet.

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| x\_api\_key  | `<Your_X_API_Key>` |

**Body**

| Name      | Type   | Description                                          |
| --------- | ------ | ---------------------------------------------------- |
| `email`   | string | User email id (Ex. - shanu@lync.world)               |
| `apiKey`  | string | Your api key generated from official website of Lync |
| `network` | number | 1 or 2 (1 for Mainnet & 2 for Testnet)               |

**Response**

{% tabs %}
{% tab title="200" %}
```json
{
  "success": true,
  "status": 200,
  "message": "Account data fetched successfully.",
  "data": {
    "id": "<ObjectId>",
    "accountAddress": "<account address of users newly created wallet>",
    "publicKey": "<public key of users newly created wallet>",
    "privateKey": "<private key of users newly created wallet>"
  }
}
```
{% endtab %}

{% tab title="201" %}
```json
{
  "success": true,
  "status": 201,
  "message": "Account Created On Chain Successfully.",
  "data": {
    "id": "<ObjectId>",
    "accountAddress": "<account address of users newly created wallet>",
    "publicKey": "<public key of users newly created wallet>",
    "privateKey": "<private key of users newly created wallet>"
    "apiKey": "<Your api key generated from official website of Lync>",
    "network": "<1 or 2 (1 for Mainnet & 2 for Testnet)>",
    "email": "<user email id>"
  }
}
```
{% endtab %}

{% tab title="400" %}
```json
{
  "success": false,
  "status": 400,
  "message": "<error message>"
}
```
{% endtab %}

{% tab title="500" %}
```json
{
  "success": false,
  "status": 500,
  "message": "Internal server error"
}
```
{% endtab %}
{% endtabs %}
