# Setup Preferred Bank

**NOTE:** 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.

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

#### Headers

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

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| bankcode<mark style="color:red;">\*</mark> | String | Bank code   |
| bankname<mark style="color:red;">\*</mark> | String | Bank Name   |

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

```json
{
  "status": true,
  "responseCode": "01",
  "message": "Preferred bank successfully updated"
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might do this:

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

```json
curl --location 'https://api.oneappgo.com/v1/updatebankprefer' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "bankcode": "120001",
    "bankname": "9 PAYMENT SERVICE BANK"
}'
```

{% endtab %}

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

```json
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.oneappgo.com/v1/updatebankprefer',
  'headers': {
    'Authorization': 'Bearer SECRET_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "bankcode": "120001",
    "bankname": "9 PAYMENT SERVICE BANK"
  })

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

```

{% endcode %}
{% endtab %}

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

```php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.oneappgo.com/v1/updatebankprefer',
  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 =>'{
    "bankcode": "120001",
    "bankname": "9 PAYMENT SERVICE BANK"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Dart" %}

```dart
var headers = {
  'Authorization': 'Bearer SECRET_KEY',
  'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://api.oneappgo.com/v1/updatebankprefer'));
request.body = json.encode({
  "bankcode": "120001",
  "bankname": "9 PAYMENT SERVICE BANK"
});
request.headers.addAll(headers);

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

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

```

{% 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.1app.online/virtual-accounts/setup-preferred-bank.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.
