> ## Documentation Index
> Fetch the complete documentation index at: https://docs.girostack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Bank Account

> This endpoint adds a bank account to the list of bank accounts associated with the user. Once added, the bank account can be used for future transfers.

`POST {{baseurl}}/bank-accounts`

<Tabs>
  <Tab title="Staging">
    ```
       https://gw.stg.girostack.com/v1
    ```
  </Tab>

  <Tab title="Production">
    ```
       https://gw.prod.girostack.com/v1
    ```
  </Tab>
</Tabs>

<Card title="Headers">
  <ParamField body="x-giro-key" type="string" required>
    Pass your account's secret key as the value.
  </ParamField>
</Card>

<Card title="Body Params">
  <ParamField body="accountName" type="string" required />

  <ParamField body="accountNumber" type="string" required />

  <ParamField body="bankName" type="string" required />

  <ParamField body="bankCode" type="string" required />

  <ParamField body="beneficiaryType" type="string">
    When provided value should be `vba`, `external` or `personal`. Default is
    `personal`.
  </ParamField>
</Card>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST '{{API_BASE_URL}}/bank-accounts' \
  --header 'x-giro-key: {{SECRET_KEY}}' \
  --header 'Content-Type: application/json' \
  --data '{
      "accountNumber": "0018730826",
      "accountName": "Salako Emmanuel",
      "bankName": "Guaranty Trust Bank",
      "bankCode": "058"
  }'
  ```

  ```javascript Node.JS theme={null}
  const fetch = require("node-fetch");

  const url = "{{API_BASE_URL}}/bank-accounts";
  const headers = {
    "x-giro-key": "{{SECRET_KEY}}",
    "Content-Type": "application/json",
  };
  const body = JSON.stringify({
    accountNumber: "0018730826",
    accountName: "Salako Emmanuel",
    bankName: "Guaranty Trust Bank",
    bankCode: "058",
  });

  fetch(url, {
    method: "POST",
    headers: headers,
    body: body,
  })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => '{{API_BASE_URL}}/bank-accounts',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => array(
      'x-giro-key: {{SECRET_KEY}}',
      'Content-Type: application/json'
    ),
    CURLOPT_POSTFIELDS => json_encode(array(
      'accountNumber':'0018730826',
      'accountName': 'Salako Emmanuel',
      'bankName': 'Guaranty Trust Bank',
      'bankCode': '058'
    ))
  ));

  $response = curl_exec($curl);
  $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

  if (curl_errno($curl)) {
    echo 'Error: ' . curl_error($curl);
  } else {
    echo "Response Code: $httpcode\n";
    echo $response;
  }

  curl_close($curl);
  ?>
  ```
</RequestExample>

<ResponseExample>
  ```json 201 OK theme={null}
  {
    "meta": {
      "statusCode": 201,
      "success": true,
      "message": "BankAccount successfully created"
    },
    "data": {
      "auth": "65b12bbf512f9932b67f53d7",
      "account": "65b12bbf36e38c6bfbe35f95",
      "accountName": "Salako Emmanuel",
      "accountNumber": "0018730826",
      "bankName": "Guaranty Trust Bank",
      "bankCode": "058",
      "reference": "9999992409440854616574301713288",
      "live": true,
      "processor": "source",
      "publicId": "bka-a709ebef-da69-4570-b1ac-48031u4hd408c",
      "id": 3,
      "createdAt": "2024-09-13T07:56:16.775Z",
      "updatedAt": "2024-09-13T07:56:16.775Z",
      "currency": "NGN",
      "lastUpdated": "2024-09-13T07:56:16.775Z",
      "version": 1,
      "beneficiaryType": "personal",
      "clientIds": {}
    }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "meta": {
      "statusCode": 400,
      "error": {
        "statusCode": 400,
        "message": "Bad request / Validation error",
        "messages": {
          "bankCode": {
            "isNotEmpty": "bankCode should not be empty",
            "isString": "bankCode must be a string"
          }
        }
      }
    }
  }
  ```
</ResponseExample>
