# Create a wallet

{% hint style="info" %} <mark style="color:blue;">Every digital wallet has a virtual account number attached</mark>
{% endhint %}

When you create a digital wallet via the API, we automatically create a *Customer* using the same information and attach a wallet.

### URI

&#x20;<mark style="color:blue;background-color:blue;">**POST**</mark>&#x20;

```
https://api.tryduplo.com/v1/wallets
```

### Parameters

#### Header

<table data-header-hidden><thead><tr><th width="249"></th><th></th></tr></thead><tbody><tr><td><strong>Authorization</strong><br><code>string</code></td><td>set value to <code>Bearer SECRET_KEY</code></td></tr></tbody></table>

#### Body Param

<table data-header-hidden><thead><tr><th width="250"></th><th></th></tr></thead><tbody><tr><td><strong>business_id</strong><br><code>string</code> <mark style="color:red;"><code>required</code></mark></td><td>Business ID</td></tr><tr><td><strong>first_name</strong><br><code>string</code> <mark style="color:red;"><code>required</code></mark></td><td>Customer's first name</td></tr><tr><td><strong>last_name</strong><br><code>string</code> <mark style="color:red;"><code>required</code></mark></td><td>Customer's last name</td></tr><tr><td><strong>phone_number</strong><br><code>string</code> <mark style="color:red;"><code>required</code></mark></td><td>Customer's phone number</td></tr><tr><td><strong>email</strong><br><code>string</code> <mark style="color:red;"><code>required</code></mark></td><td>Customer's email address</td></tr><tr><td><strong>bvn</strong><br><code>string</code> </td><td>Customer's bank verification number</td></tr><tr><td><strong>metadata</strong><br><code>string</code> </td><td>Customer's specific data - Stringified JSON</td></tr><tr><td><strong>preferred_banks</strong><br><code>array</code></td><td>List of customer's preferred banks</td></tr></tbody></table>

### Sample request

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --location --request POST 'https://api.tryduplo.com/v1/wallets' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
   "business_id": {YOUR_VALUE},
   "first_name": "John",
   "last_name": "Bellion",
   "email": "john@gmail.com",
   "bvn": "23835759875",
   "phone_number":"08010940168",
   "metadata": "{'invoice_id': '11973600964773'}",
   "preferred_banks": [
       {
           "bank_code": "111",
           "bank_name": "Wema Bank",
           "id": "wema"
       }
   ]
}'
```

{% endcode %}
{% endtab %}

{% tab title="Node" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
var axios = require("axios");
var data = JSON.stringify({
  business_id: {YOUR_VALUE},
  first_name: "John",
  last_name: "Bellion",
  email: "john@gmail.com",
  bvn: "23835759875",
  phone_number: "08010940168",
  metadata: "{'invoice_id': '11973600964773'}",
  preferred_banks: [
    {
      bank_code: "111",
      bank_name: "Wema Bank",
      id: "wema",
    },
  ],
});

var config = {
  method: "post",
  url: "https://api.tryduplo.com/v1/wallets",
  headers: {
    Authorization: "Bearer SECRET_KEY",
    "Content-Type": "application/json",
  },
  data: data,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code overflow="wrap" lineNumbers="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://api.tryduplo.com/v1/wallets',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS =>'{
   "business_id": {YOUR_VALUE},
   "first_name": "John",
   "last_name": "Bellion",
   "email": "john@gmail.com",
   "bvn": "23835759875",
   "phone_number":"08010940168",
   "metadata": "{\'invoice_id\': \'11973600964773\'}",
   "preferred_banks": [
       {
           "bank_code": "111",
           "bank_name": "Wema Bank",
           "id": "wema"
       }
   ]
}',
 CURLOPT_HTTPHEADER => array(
   'Authorization: Bearer SECRET_KEY',
   'Content-Type: application/json'
 ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Duplo Response

```json
{
  "data": {
    "wallet_ref": "wal_7sdgewehe8",
    "first_name": "Manny",
    "last_name": "Norte",
    "email": "alindavidsisn@gmail.co",
    "created_at": "2021-09-28T20:28:47.000Z",
    "currency": "NGN",
    "status": "active",
    "is_master": true,
    "available_balance": "0.00",
    "legder_balance": "0.00",
    "opening_balance": "0.00",
    "closing_balance": "0.00",
    "bank_accounts": [
      {
        "account_ref": "act_gd53hs7enw3",
        "account_number": "9977658661",
        "created_at": "2021-09-28T20:28:47.000Z",
        "account_name": "MERCHANT(Manny Norte)",
        "provider": {
          "bank_code": "022",
          "bank_name": "wema",
          "id": "wema",
          "default": true
        }
      }
    ]
  },
  "errors": {},
  "message": "Wallet created successfully"
}
```


---

# 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://developers.tryduplo.com/duplo-api-documentation/payment-apis/collect-payments/digital-wallets/create-a-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.
