---
page_source: https://juspay.io/in/docs/api-reference/docs/virtual-account--ecollect/create-van
page_title: Create VAN
---

## API Version: default


# Virtual Account Creation API



This API will create virtual accounts to be used for making transactions by customers.## Endpoints:
- Sandbox: https://sandbox.juspay.in/customers/:customer_id/virtual-accounts

- Production: https://api.juspay.in/customers/:customer_id/virtual-accounts

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from Juspay dashboard
* Password: Empty string

Example:- Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Value: MUQ2QUZEQzhFQTY0OUU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: required, Base64 Encoded username:password
## Headers:

#### x-routing-id:
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.

> **Warning**
> This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.


- Value: customer_1122
- Tags: String, Required
## Sample Code Snippets:
### Code Snippets:

#### Request - Virtual Account Creation Code Snippet:

```request - virtual account creation
curl --location 'https://api.juspay.in/customers/:customer_id/virtual-accounts' \
--header 'Content-Type: application/json' \
--header 'x-routing-id: customer_1122'\
--header 'Authorization: Basic SlVTUEFZOmVkYzEXXXXXXXXXXExOGExMjRjMA==' \
--data '{
    "virtual_account_reference": "vaRef1",
    "type": "ACCOUNT_IFSC",
    "parent_reference_id": "parentAccount1"
}'

```

### Sample Request and Response:

#### Response - 200:
```json
{
	"status": "ENABLED",
	"virtual_account": "ABCD320915166064",
	"virtual_account_reference": "tee9",
	"customer_id": "cth_gAYegMPaf5XwbNdM",
	"ifsc": "UTIB0CCH274",
	"type": "ACCOUNT_IFSC"
      "date_created": "2023-07-31T09:00:52Z",
      "last_updated": "2023-07-31T09:00:52Z",
      "metadata" : "{\"name\":\"Hitesh\", \"city\": \"Jaipur\"}"
}

```

#### Response - 400 (Invalid Virtual Account):
```json
{
	"status": "error",
	"error_code": "invalid_request",
	"error_message": "Virtual Account with given virtual_account_reference already exists for customer."
}

```

#### Response - 400 (Invalid Customer Id):
```json
{
	"status": "error",
	"error_code": "invalid_request",
	"error_message": "Customer not found"
}

```

## Path Parameters:

#### customer_id:
Customer ID provided by Juspay or object reference Id given by merchant while customer creation.
- Tags: String, Mandatory
## Body Parameters:
### Basic Parameters:

#### virtual_account_reference:
- Description: Unique ID that merchants can use to represent the virtual account. [AlphaNumeric Values Only]
- Value: value
- Tags: String, Mandatory

#### type:
- Description: The type of virtual account merchant wants to create. Currently the default is ACCOUNT_IFSC (Virtual Bank Account)
- Tags: String, Mandatory

#### parent_reference_id:
- Description: The reference against which the merchant wants to create the virtual account against.
- Tags: String, Mandatory

#### metadata:
- Description: A custom key-value set can be passed here. Stringified JSON. No PII allowed.
- Tags: String
## API Responses:
### 200:

#### status:
- Tags: String

#### virtual_account:
- Tags: String

#### virtual_account_reference:
- Tags: String

#### customer_id:
- Tags: String

#### ifsc:
- Tags: String

#### type:
- Tags: String

#### date_created:
- Tags: String

#### last_updated:
- Tags: String

#### metadata:
- Tags: String
### 400:

#### status:
- Tags: String

#### error_code:
- Tags: String

#### error_message:
- Tags: String
