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

# Create single-use virtual account

> Generate a one-time virtual account that expires after a single payment or a set duration.

Single-use virtual accounts are ideal for checkout flows where you want to collect a specific amount from a specific payer. The account expires automatically once used or when the `duration` elapses.

## Endpoint

```
POST /clients/business/virtual-accounts/single-use
```

## Headers

<ParamField header="Authorization" type="string" required>
  `Bearer YOUR_ACCESS_TOKEN`
</ParamField>

<ParamField header="SECRET_KEY" type="string" required>
  Your API secret key.
</ParamField>

<ParamField header="businessId" type="string" required>
  Your business ID.
</ParamField>

## Request body

<ParamField body="firstName" type="string" required>
  First name to assign to the virtual account holder.
</ParamField>

<ParamField body="lastName" type="string" required>
  Last name to assign to the virtual account holder.
</ParamField>

<ParamField body="refCode" type="string" required>
  A unique reference code from your system to identify this account and the corresponding transaction.
</ParamField>

<ParamField body="amount" type="integer" required>
  The exact amount the account is configured to accept, in **kobo**. For example, `500000` equals ₦5,000.
</ParamField>

<ParamField body="duration" type="integer" required>
  Time in seconds before the account expires. For example, `36000` for 10 hours.
</ParamField>

## Response

Returns `201 Created` on success.

<ResponseField name="status" type="boolean">
  `true` on success.
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message, e.g. `"Account generated successfully"`.
</ResponseField>

<ResponseField name="data.accountNumber" type="string">
  The NUBAN account number generated for this single-use account.
</ResponseField>

<ResponseField name="data.accountName" type="string">
  The name on the account, derived from the `firstName` and `lastName` provided.
</ResponseField>

<ResponseField name="data.clientReference" type="string">
  The `refCode` you supplied, echoed back for confirmation.
</ResponseField>

<ResponseField name="data.systemReference" type="string">
  A unique reference generated by Interstellas for this account.
</ResponseField>

<ResponseField name="data.reservedAmount" type="integer">
  The amount reserved on this account, in kobo.
</ResponseField>

<ResponseField name="data.expiresAt" type="string">
  ISO 8601 timestamp of when this account will expire.
</ResponseField>

## Code examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://sandbox.stellasbank.com/api/v1/clients/business/virtual-accounts/single-use \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "SECRET_KEY: YOUR_SECRET_KEY" \
    -H "businessId: YOUR_BUSINESS_ID" \
    -H "Content-Type: application/json" \
    -d '{
      "firstName": "Ada",
      "lastName": "Lovelace",
      "refCode": "order_12345",
      "amount": 500000,
      "duration": 36000
    }'
  ```

  ```js Node.js theme={null}
  const res = await fetch(
    "https://sandbox.stellasbank.com/api/v1/clients/business/virtual-accounts/single-use",
    {
      method: "POST",
      headers: {
        Authorization: "Bearer YOUR_ACCESS_TOKEN",
        SECRET_KEY: "YOUR_SECRET_KEY",
        businessId: "YOUR_BUSINESS_ID",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        firstName: "Ada",
        lastName: "Lovelace",
        refCode: "order_12345",
        amount: 500000,
        duration: 36000,
      }),
    }
  );
  const { data } = await res.json();
  ```

  ```python Python theme={null}
  import requests

  res = requests.post(
      "https://sandbox.stellasbank.com/api/v1/clients/business/virtual-accounts/single-use",
      headers={
          "Authorization": "Bearer YOUR_ACCESS_TOKEN",
          "SECRET_KEY": "YOUR_SECRET_KEY",
          "businessId": "YOUR_BUSINESS_ID",
      },
      json={
          "firstName": "Ada",
          "lastName": "Lovelace",
          "refCode": "order_12345",
          "amount": 500000,
          "duration": 36000,
      },
  )
  print(res.json())
  ```
</CodeGroup>

## Example response

```json theme={null}
{
  "status": true,
  "message": "Account generated successfully",
  "data": {
    "accountNumber": "9012345678",
    "accountName": "Ada Lovelace",
    "clientReference": "order_12345",
    "systemReference": "sys_ref_abc789",
    "reservedAmount": 500000,
    "expiresAt": "2024-06-10T10:00:00.000Z"
  }
}
```

<Info>
  All amounts are in **kobo**. Divide by 100 to convert to naira.
</Info>
