# Update a virtual account

### URI

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

```
https://api.tryduplo.com/v1/virtual-accounts/:account_ref?business_id={BUSINESS_ID}
```

### Parameters

#### Header

<table data-header-hidden><thead><tr><th width="171"></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>

#### Path Param

| <p><strong>account\_ref</strong>         <br><code>string</code>   <mark style="color:red;"><code>required</code></mark></p> | Virtual account reference |
| ---------------------------------------------------------------------------------------------------------------------------- | ------------------------- |

#### Body Param

<table data-header-hidden><thead><tr><th width="253"></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>account_name</strong>         <br><code>string</code>   <mark style="color:red;"><code>required</code></mark></td><td>Virtual account name</td></tr><tr><td><strong>provider</strong>         <br><code>string</code>   </td><td>Prefered bank provider</td></tr><tr><td><strong>firstname</strong>         <br><code>string</code>  </td><td>Account firstname</td></tr><tr><td><strong>lastname</strong>         <br><code>string</code>  </td><td>Account lastname</td></tr><tr><td><strong>email</strong>         <br><code>string</code>  </td><td>Account email</td></tr><tr><td><strong>phone_number</strong>         <br><code>string</code> </td><td>Account phone number</td></tr><tr><td><strong>amount</strong>         <br><code>string</code>  </td><td>Amount to be received</td></tr></tbody></table>

### Sample request

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

```bash
curl --location --request PATCH 'https://api.tryduplo.com/v1/virtual-accounts/:account_ref?business_id={YOUR_VALUE}' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
   "account_name": "John doe",
   "provider": "providus"
}'
```

{% endcode %}
{% endtab %}

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

```javascript
var axios = require('axios');
var data = JSON.stringify({
 "account_name": "John doe",
 "provider": "providus"
});

var config = {
 method: 'patch',
 url: 'https://api.tryduplo.com/v1/virtual-accounts/:account_ref?business_id={YOUR_VALUE}',
 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/virtual-accounts/:account_ref?business_id={YOUR_VALUE}',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'PATCH',
 CURLOPT_POSTFIELDS =>'{
   "account_name": "John doe",
   "provider": "providus"
}',
 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": {
       "provider": {
           "bank_code": "053",
           "bank_name": "Providus",
           "id": "providus",
           "default": true
       },
       "email": "alindavdsin@gmail.com",
       "phone_number": "08085279945",
       "account_ref": "act_jdnusyEcN",
       "created_at": "2021-09-28T20:10:07.000Z",
       "status": "active",
       "account_name": "John doe",
       "account_number": "9977658630",
       "bvn": "39372746283"
   },
   "errors": {},
   "message": "Request successful"
}
```


---

# 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/virtual-accounts/update-a-virtual-account.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.
