# Generate Account

<mark style="color:green;">`POST`</mark> `https://api.oneappgo.com/v1/dedicated-account`

You can pass **bankcode** as a field to the generate account endpoint to generate account number on the go without considering the default set bank. Get the list of available bank and their code from the **partnerbank** endpoint.

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| authorization<mark style="color:red;">\*</mark> | String | SECRET\_KEY |

#### Request Body

| Name                                         | Type   | Description                                     |
| -------------------------------------------- | ------ | ----------------------------------------------- |
| trackingid<mark style="color:red;">\*</mark> | String | A unique id for the user generating account for |
| firstname<mark style="color:red;">\*</mark>  | String | First name of the user                          |
| lastname<mark style="color:red;">\*</mark>   | String | Last name of the user                           |
| userbvn<mark style="color:red;">\*</mark>    | String | Bank Verification Number  of the user           |
| useremail<mark style="color:red;">\*</mark>  | String | Email Address                                   |
| userphone<mark style="color:red;">\*</mark>  | String | Phone number                                    |
| bankcode                                     | String | Bank code                                       |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "status": true,
  "message": "Account Number Successfully Generated",
  "trackingref": "001858002",
  "trackingid": "002",
  "acctname": "John Doe",
  "acctno": "3984124113",
  "clientid": "1858000",
  "bankcode": "120001",
  "bankname": "9 PAYMENT SERVICE BANK"
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might do this:

{% tabs %}
{% tab title="cURL" %}

```php
curl --location 'https://api.oneappgo.com/v1/dedicated-account' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "trackingid": "2727",
    "firstname": "John",
    "lastname": "Doe",
    "userbvn": "22222253444",
    "useremail": "johndoe@example.com",
    "userphone": "09123456789",
    "bankcode": "120001"
}'
```

{% endtab %}

{% tab title="NodeJs" %}

```json
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.oneappgo.com/v1/dedicated-account',
  'headers': {
    'Authorization': 'Bearer SECRET_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "trackingid": "2727",
    "firstname": "John",
    "lastname": "Doe",
    "userbvn": "22222253444",
    "useremail": "johndoe@example.com",
    "userphone": "09123456789",
    "bankcode": "120001"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

{% endtab %}

{% tab title="PHP - cURL" %}

```php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.oneappgo.com/v1/dedicated-account',
  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 =>'{
    "trackingid": "2727",
    "firstname": "John",
    "lastname": "Doe",
    "userbvn": "22222253444",
    "useremail": "johndoe@example.com",
    "userphone": "09123456789",
    "bankcode": "120001"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Dart" %}
{% code overflow="wrap" %}

```dart
var headers = {
  'Authorization': 'Bearer SECRET_KEY',
  'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://api.oneappgo.com/v1/dedicated-account'));
request.body = json.encode({
  "trackingid": "2727",
  "firstname": "John",
  "lastname": "Doe",
  "userbvn": "22222253444",
  "useremail": "johndoe@example.com",
  "userphone": "09123456789",
  "bankcode": "120001"
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}

```

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

## Sample response

```json
{
  "status": true,
  "message": "Account Number Successfully Generated",
  "trackingref": "001858002",
  "trackingid": "002",
  "acctname": "John Doe",
  "acctno": "3984124113",
  "clientid": "1858000",
  "bankcode": "120001",
  "bankname": "9 PAYMENT SERVICE BANK"
}
```


---

# 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.1app.online/virtual-accounts/generate-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.
