# 开立虚拟账户

> 为指定用户提交虚拟账户开户请求。

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: embedded-finance/virtual-accounts/open-virtual-account
info:
  title: 开立虚拟账户
  version: original
  description: 为指定用户提交虚拟账户开户请求。
servers:
  - url: https://sandbox-baas.onerway.com/embedded-finance
    description: sandbox
  - url: https://baas.onerway.com
    description: production
paths:
  /api/v2/virtual-account/open:
    post:
      summary: 开立虚拟账户
      description: 为指定用户提交虚拟账户开户请求。
      parameters:
        - name: apiKey
          in: header
          required: true
          description: 用于访问嵌入式金融 API 的 API key。
          schema:
            type: string
            description: 用于访问嵌入式金融 API 的 API key。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                userId:
                  type: integer
                  description: 需要开立虚拟账户的用户 ID。
                bankCountry:
                  type: string
                  description: 银行所在国家或地区，使用 ISO 3166-1 alpha-2 两位代码。
                currencyCode:
                  type: string
                  description: 待开立虚拟账户的币种代码。
              required:
                - userId
                - bankCountry
                - currencyCode
            examples:
              default:
                summary: 开立虚拟账户
                value:
                  userId: 123456789
                  bankCountry: GB
                  currencyCode: GBP
      responses:
        "200":
          description: 虚拟账户开户请求成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: Onerway 返回的响应码；`20000` 表示请求成功。
                  respMsg:
                    type: string
                    description: 响应码对应的可读消息。
                  data:
                    type: object
                    properties:
                      merchantNo:
                        type: string
                        description: 该申请所属的商户号。
                      userId:
                        type: integer
                        description: 申请开立虚拟账户的用户 ID。
                      vaApplicationId:
                        type: integer
                        description: 虚拟账户申请 ID，开立虚拟账户的 Webhook 通知和虚拟账户销户都使用此 ID。
                    description: 请求成功后返回的虚拟账户申请信息。
              examples:
                success:
                  summary: 虚拟账户开户请求成功
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      merchantNo: 800***
                      userId: 123456789
                      vaApplicationId: 987654321
      security:
        - apiKeyAuth:
            []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apiKey
```
