> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.shimi.cash/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.shimi.cash/_mcp/server.

# Generate Virtual Account

POST https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate
Content-Type: application/json

Generates a single-use virtual account number for collecting exactly `amount`. Minimum ₦1,000, maximum ₦10,000,000.

`settlementId` is optional: if provided, the funds are credited to that settlement (wallet) account instead of your default one. You are notified by webhook when it's funded (see **Webhooks You'll Receive**).

**Body (JSON)**

| Field          | Type    | Required | Rules                                                                                                                            |
| -------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `amount`       | number  | yes      | 1,000 - 10,000,000 (NGN). Send as a JSON number.                                                                                 |
| `settlementId` | integer | no       | One of your settlement account IDs. Send as a JSON number. A numeric string passes the check but makes the database lookup fail. |

**Behaviour notes**

* Returns a single-use account to collect exactly `amount` before `expiryDate`.
* Keep `virtual_trx_id`: it's the `:transactionId` for **Fetch Virtual Account Transaction**.
* `reference` is the provider's external reference, which is also sent in the funding webhook.
* `bankName` in this response is always `SAFEHAVEN MICROFINANCE`.
* The error text for amounts over the maximum says `1000000`, but the real limit is ₦10,000,000.
* All errors are HTTP 400 with `{ status: "error", message }`.

Reference: https://docs.shimi.cash/api-reference/shimi-api/virtual-accounts/generate-virtual-account

## Authentication

- `Authorization` header (bearer token, required) — Access token from Generate Access Token (valid 15 minutes).

## Request

### Body (application/json)

This endpoint expects an object.

- `amount` (integer, optional)
- `settlementId` (integer, optional)

## Response

### 200

OK

- `status` (string, optional)
- `data` (VirtualAccountGeneratePostResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 400 Bad Request Error

Amount missing / Amount below minimum / Amount above maximum / Settlement account not found

- `status` (string, optional)
- `message` (string, optional)

### 401 Unauthorized Error

Unauthorized

- `message` (string, optional)

### 403 Forbidden Error

Invalid or expired access token / KYB not approved / Account deactivated

- `message` (string, optional)
- `code` (string, optional)
- `kybStatus` (string, optional)

## Types

### VirtualAccountGeneratePostResponsesContentApplicationJsonSchemaData

- `virtual_trx_id` (string, optional)
- `reference` (string, optional)
- `bankCode` (string, optional)
- `accountNumber` (string, optional)
- `accountName` (string, optional)
- `amount` (integer, optional)
- `bankName` (string, optional)
- `expiryDate` (string, optional)

## Examples

### 200 Success

**Response**

```json
{
  "status": "success",
  "data": {
    "virtual_trx_id": "cmgd2j6k50003mn8z4q7r1s9t",
    "reference": "cmgd2j6k50003mn8z4q7r1s9t",
    "bankCode": "090286",
    "accountNumber": "8800417263",
    "accountName": "SHIMI CHECKOUT",
    "amount": 5000,
    "bankName": "SAFEHAVEN MICROFINANCE",
    "expiryDate": "2026-10-04T11:05:12.000Z"
  }
}
```

**SDK Code**

```python 200 Success
import requests

url = "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript 200 Success
const url = 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 200 Success
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 200 Success
require 'uri'
require 'net/http'

url = URI("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java 200 Success
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 200 Success
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp 200 Success
using RestSharp;

var client = new RestClient("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 Success
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Virtual Accounts_generateVirtualAccount_example

**Request**

```json
{
  "amount": 5000,
  "settlementId": 1
}
```

**Response**

```json
{
  "status": "success",
  "data": {
    "virtual_trx_id": "cmgd2j6k50003mn8z4q7r1s9t",
    "reference": "cmgd2j6k50003mn8z4q7r1s9t",
    "bankCode": "090286",
    "accountNumber": "8800417263",
    "accountName": "SHIMI CHECKOUT",
    "amount": 5000,
    "bankName": "SAFEHAVEN MICROFINANCE",
    "expiryDate": "2026-10-04T11:05:12.000Z"
  }
}
```

**SDK Code**

```python Virtual Accounts_generateVirtualAccount_example
import requests

url = "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate"

payload = {
    "amount": 5000,
    "settlementId": 1
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Virtual Accounts_generateVirtualAccount_example
const url = 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"amount":5000,"settlementId":1}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Virtual Accounts_generateVirtualAccount_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate"

	payload := strings.NewReader("{\n  \"amount\": 5000,\n  \"settlementId\": 1\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Virtual Accounts_generateVirtualAccount_example
require 'uri'
require 'net/http'

url = URI("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": 5000,\n  \"settlementId\": 1\n}"

response = http.request(request)
puts response.read_body
```

```java Virtual Accounts_generateVirtualAccount_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": 5000,\n  \"settlementId\": 1\n}")
  .asString();
```

```php Virtual Accounts_generateVirtualAccount_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate', [
  'body' => '{
  "amount": 5000,
  "settlementId": 1
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Virtual Accounts_generateVirtualAccount_example
using RestSharp;

var client = new RestClient("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": 5000,\n  \"settlementId\": 1\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Virtual Accounts_generateVirtualAccount_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": 5000,
  "settlementId": 1
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/virtual-account/generate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```