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

# Create test deposit

> Create a settled deposit transaction for a test user. Useful for simulating payments in sandbox environments.

<Warning>
  These test endpoints are **only available in development and staging environments**. They are disabled in
  production for security reasons.
</Warning>

<Tip>See the [Sandbox payments flow](/flows/sandbox-payments) for detailed examples and usage patterns.</Tip>


## OpenAPI

````yaml POST /test/deposits
openapi: 3.0.3
info:
  title: Wealthyhood Test API
  version: 1.0.0
  description: >
    Test endpoints for sandbox environments. These endpoints allow you to create
    test users, simulate deposits,

    send test app notifications, and manage test data.


    **Important**: These endpoints are only available in development and staging
    environments. They are disabled in production for security reasons.


    All requests require a bearer token.
servers:
  - url: https://{host}
    variables:
      host:
        default: api.sandbox.wealthyhood.com
        description: Wealthyhood API host name (sandbox environment).
security:
  - bearerAuth: []
tags:
  - name: Test
    description: Test endpoints for sandbox environments.
paths:
  /test/deposits:
    post:
      tags:
        - Test
      summary: Create test deposit
      description: >
        Create a settled deposit transaction for a test user. This endpoint
        immediately creates a deposit with `Settled` status and updates the
        user's cash availability, making it useful for simulating payments in
        sandbox environments.


        You can specify a bank account in one of three ways:

        1. Provide a `bankAccount` object to create a new bank account (will be
        created if it doesn't exist)

        2. Provide a `bankAccountId` to use an existing bank account

        3. Provide neither to use the user's first bank account (if available)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - userId
                - amount
              properties:
                userId:
                  type: string
                  pattern: ^[a-f0-9]{24}$
                  description: MongoDB ObjectId of the user who will receive the deposit
                  example: 64f0c51e7fb3fc001234abcd
                amount:
                  type: number
                  minimum: 0.01
                  description: >-
                    Deposit amount in whole currency units (e.g., 100.50 for
                    £100.50)
                  example: 100.5
                bankAccountId:
                  type: string
                  pattern: ^[a-f0-9]{24}$
                  description: >-
                    MongoDB ObjectId of an existing bank account to use for the
                    deposit. Cannot be provided together with `bankAccount`.
                  example: 64f1b2c3d4e5f67890123457
                bankAccount:
                  type: object
                  description: >-
                    Bank account details to create and associate with the
                    deposit. Cannot be provided together with `bankAccountId`.
                    Currency is hardcoded to EUR.
                  required:
                    - holderName
                    - iban
                    - bic
                  properties:
                    holderName:
                      type: string
                      description: Name of the account holder
                      example: Account Holder Name
                    iban:
                      type: string
                      description: IBAN (International Bank Account Number)
                      example: GR1601101250000000012300695
                    bic:
                      type: string
                      description: BIC (Bank Identifier Code)
                      example: ETHNGRAA
            examples:
              withBankAccount:
                summary: Create deposit with new bank account
                value:
                  userId: 64f1b2c3d4e5f67890123456
                  amount: 100
                  bankAccount:
                    holderName: Account Holder Name
                    iban: GR1601101250000000012300695
                    bic: ETHNGRAA
              withBankAccountId:
                summary: Create deposit with existing bank account ID
                value:
                  userId: 64f1b2c3d4e5f67890123456
                  amount: 100
                  bankAccountId: 64f1b2c3d4e5f67890123457
              withoutBankAccount:
                summary: Create deposit using first available bank account
                value:
                  userId: 64f1b2c3d4e5f67890123456
                  amount: 100
      responses:
        '201':
          description: Deposit created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestDeposit'
        '400':
          description: >-
            Bad request – invalid parameters, user does not have a portfolio, or
            bank account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                noPortfolio:
                  summary: User does not have a portfolio
                  value:
                    message: User does not have a portfolio
                    code: BAD_REQUEST
                bankAccountNotFound:
                  summary: Bank account not found
                  value:
                    message: Bank account not found for user
                    code: BAD_REQUEST
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: User not found
                code: NOT_FOUND
components:
  schemas:
    TestDeposit:
      type: object
      required:
        - id
        - ownerId
        - amount
        - currency
        - status
        - createdAt
      properties:
        id:
          type: string
          example: dep_64f0c51e7fb3fc001234abcd
        ownerId:
          type: string
          description: MongoDB ObjectId of the user who owns the deposit
          example: 64f0c51e7fb3fc001234abcd
        amount:
          type: number
          description: Deposit amount in cents (minor currency units)
          example: 10050
        currency:
          type: string
          description: ISO 4217 currency code
          example: EUR
        status:
          type: string
          description: Transaction status (always "Settled" for test deposits)
          example: Settled
        reference:
          type: string
          description: Automatically generated bank reference
          example: a1B2c3D4e5F6g7H8
        createdAt:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00.000Z'
    Error:
      type: object
      required:
        - message
        - code
      properties:
        message:
          type: string
          example: Invalid amount
        code:
          type: string
          example: BAD_REQUEST
  responses:
    UnauthorizedError:
      description: Unauthorized – missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Authentication required
            code: UNAUTHORIZED
    ForbiddenError:
      description: >-
        Forbidden – valid credentials but insufficient permissions or endpoint
        not available in this environment.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Endpoint not available in production
            code: FORBIDDEN
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````