# Create wallet

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/wallets:
    post:
      summary: Create wallet
      deprecated: false
      description: >
        Create a new wallet under a closed-loop business account.

        This endpoint generates both the wallet record and its associated
        account number, automatically linked to the specified business based on
        the account prefix convention.


        Wallets can be used for a variety of purposes and are identified by
        their name and label.


        ### Wallet Account Structure

        On success, the system creates an account number for the wallet:

        - Prefixed according to its type and purpose (9 = individual wallet).

        - Account numbers are unique and internally linked to the business’s
        operational ledger.

        - Wallets start with balance = 0 and status = ACTIVE.

        - Each wallet is automatically linked to the business through its prefix
        rule and businessId.
      operationId: create-wallet
      tags:
        - Vrtx Closed loop/Wallets
        - Wallets
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WalletCreateRequest'
            examples:
              WalletCreateRequest:
                value:
                  business_id: 01df2b9e-e17b-4372-a589-a627fc2c6929
                  name: ' 2 1111محفظة رئيسية'
                  label_id: da28e8f5-f675-477c-81e6-de174f766be1
                  external_reference: WALLET-RIYADH-00122111444331
                  can_overdraft: false
                  status: ACTIVE
                  currency: SAR
                summary: WalletCreateRequest
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                x-apidog-orders: []
                properties: {}
                x-apidog-ignore-properties: []
              examples:
                WalletCreated:
                  summary: WalletCreated
                  value:
                    id: d8a7f71f-cabd-4720-b7cc-b6745a10cbe2
                    business_id: 2bb58ca6-1b9a-47b4-ab4d-b2996f0498f3
                    name: محفظة رئيسية
                    label_id: 5a36c74a-e479-43cd-a420-fb72a591d3e6
                    external_reference: WALLET-RIYADH-00122
                    can_overdraft: false
                    status: ACTIVE
                    account_number: '054200007018'
                    currency: SAR
                    balance: '0.00'
                    created_at: '2025-10-25T14:10:15.151Z'
                    updated_at: '2025-10-25T14:10:15.151Z'
          headers: {}
          x-apidog-name: Created
        '400':
          description: Bad Request
          content:
            application/json:
              schema: &ref_0
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                BadRequest:
                  summary: BadRequest
                  value:
                    error_code: INVALID_INPUT
                    error_message: Input parameters failed validation
                    details:
                      - field: business_id
                        message: business_id is required
                        code: required
                    status_code: 400
          headers: {}
          x-apidog-name: Bad Request
        '401':
          description: Not Authorized
          content:
            application/json:
              schema: *ref_0
              examples:
                Unauthorized:
                  summary: Unauthorized
                  value:
                    error_code: UNAUTHORIZED_ACCESS
                    error_message: You are not authorized to access this resource.
                    details:
                      - field: authorization
                        message: Valid Bearer token required
                        code: unauthorized_access
                    status_code: 401
          headers: {}
          x-apidog-name: Unauthorized
        '403':
          description: Not Allowed
          content:
            application/json:
              schema: *ref_0
              examples:
                Forbidden:
                  summary: Forbidden
                  value:
                    error_code: FORBIDDEN
                    error_message: Forbidden
                    details:
                      - field: authorization
                        message: Insufficient permissions to access this resource
                        code: forbidden
                    status_code: 403
          headers: {}
          x-apidog-name: Forbidden
      security:
        - bearerAuth3: []
          x-apidog:
            schemeGroups:
              - id: VAiwQWR1DM1Vph4SsJAkC
                schemeIds:
                  - bearerAuth3
            required: true
            use:
              id: VAiwQWR1DM1Vph4SsJAkC
            scopes:
              VAiwQWR1DM1Vph4SsJAkC:
                bearerAuth3: []
      x-apidog-folder: Vrtx Closed loop/Wallets
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1053095/apis/api-24814176-run
components:
  schemas:
    WalletCreateRequest:
      type: object
      required:
        - name
        - currency
      description: Request body for provisioning a new wallet.
      properties:
        business_id: &ref_1
          $ref: '#/components/schemas/UUID'
          examples:
            - 11111111-2222-3333-4444-555555555555
          description: Owning business ID
        name:
          type: string
          minLength: 3
          examples:
            - محفظة رئيسية
          maxLength: 64
          description: Wallet display name
        label_id:
          examples:
            - 99999999-8888-7777-6666-555555555555
          description: Label assigned to the wallet
          anyOf:
            - *ref_1
            - type: 'null'
        external_reference:
          type: string
          examples:
            - WALLET-RIYADH-001
          maxLength: 120
          description: External reference for reconciliation
          nullable: true
        can_overdraft:
          type: boolean
          description: Whether the wallet can be overdrawn
          default: false
          nullable: true
        overdraft_limit_minor:
          type: integer
          format: int64
          examples:
            - 10000
          description: >-
            Overdraft limit in minor units (e.g. halalas). Defaults to
            configured baseline when null
          nullable: true
        status:
          type: string
          examples:
            - ACTIVE
          pattern: ^(ACTIVE|INACTIVE)$
          description: Lifecycle status
          default: ACTIVE
          nullable: true
        currency:
          type: string
          examples:
            - SAR
          pattern: ^[A-Z]{3}$
          description: ISO 4217 currency
      x-apidog-orders:
        - business_id
        - name
        - label_id
        - external_reference
        - can_overdraft
        - overdraft_limit_minor
        - status
        - currency
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    UUID:
      type: string
      format: uuid
      pattern: >-
        [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}
      x-apidog-folder: ''
    ErrorResponse:
      type: object
      properties:
        error_code:
          type: string
        error_message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
        status_code:
          type: integer
          format: int32
      x-apidog-orders:
        - error_code
        - error_message
        - details
        - status_code
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    ErrorDetail:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
        code:
          type: string
      x-apidog-orders:
        - field
        - message
        - code
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    bearerAuth:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      description: Enter your JWT access token for authentication
    bearerAuth1:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
    bearerAuth2:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      description: Enter your JWT access token for authentication
    bearerAuth3:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT issued by Keycloak. The client_id/azp in the token must map to a
        configured tenant (public, fai, neomrs; e.g., fai-sandbox -> fai) or
        requests will return 403.
    bearerAuth4:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      description: Enter your JWT access token for authentication
    bearer:
      type: http
      scheme: bearer
servers:
  - url: https://api.sandbox.vrtx.sa
    description: Sandbox
security:
  - bearer: []

```
