> ## Documentation Index
> Fetch the complete documentation index at: https://whitebit-mintlify-fix-broken-links-1774051868.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Flex Investment



## OpenAPI

````yaml /openapi/private/main_api_v4.yaml POST /api/v4/main-account/smart-flex/investments/invest
openapi: 3.0.3
info:
  title: WhiteBIT Private HTTP API V4
  description: |
    WhiteBIT Private HTTP API V4 for Main balance changes.

    Base URL: https://whitebit.com

    All endpoints return time in Unix-time format.
    All endpoints return either a JSON object or array.
    For receiving responses from API calls please use http method POST.
  version: 4.0.0
  contact:
    name: WhiteBIT Support
    email: support@whitebit.com
    url: https://whitebit.com
servers:
  - url: https://whitebit.com
    description: WhiteBIT Global Server
  - url: https://whitebit.eu
    description: WhiteBIT EU Server
security:
  - ApiKeyAuth: []
tags:
  - name: Main Account
    description: Main account balance and operations
  - name: Deposit
    description: Cryptocurrency and fiat deposit operations
  - name: Withdraw
    description: Cryptocurrency and fiat withdrawal operations
  - name: Transfer
    description: Balance transfer operations
  - name: Codes
    description: WhiteBIT codes operations
  - name: Crypto Lending - Fixed
    description: Fixed crypto lending plans
  - name: Crypto Lending - Flex
    description: Flexible crypto lending plans
  - name: Fees
    description: Fee information
  - name: Sub-Account
    description: Sub-account management
  - name: Sub-Account API Keys
    description: Sub-account API key management
  - name: Mining Pool
    description: Mining pool operations
  - name: Credit Line
    description: Credit line information
  - name: JWT
    description: JWT token management
paths:
  /api/v4/main-account/smart-flex/investments/invest:
    post:
      tags:
        - Crypto Lending - Flex
      summary: Create Flex Investment
      description: |
        Create new investment in a Flex plan.

        <Warning>
        Rate limit: 1000 requests/10 sec.
        </Warning>

        <Note>
        The API does not cache the response.
        </Note>
      operationId: createFlexInvestment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - plan
                - amount
                - request
                - nonce
              properties:
                plan:
                  type: string
                  description: Plan external ID (UUID).
                  example: 8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f
                amount:
                  type: string
                  description: Investment amount.
                  example: '1000.500000'
                withReinvest:
                  type: boolean
                  default: false
                  description: Enable auto-reinvestment.
                  example: true
                request:
                  type: string
                  description: Request signature
                  example: '{{request}}'
                nonce:
                  type: string
                  description: Unique request identifier
                  example: '{{nonce}}'
            example:
              plan: 8f2e9d3c-1a4b-4c2d-9e5f-6a7b8c9d0e1f
              amount: '1000.500000'
              withReinvest: true
              request: '{{request}}'
              nonce: '{{nonce}}'
      responses:
        '201':
          description: Investment created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      transaction_id:
                        type: string
                        description: Transaction ID for the investment
              example:
                data:
                  transaction_id: tx_9f3e0d4c-2b5c-4d3e-8f6g-7a8b9c0d1e2f
        '400':
          description: Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: 0
                message: Validation failed
                errors:
                  plan:
                    - validation.required
                  amount:
                    - validation.numeric
        '422':
          description: Business logic error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorInner'
              example:
                code: 2
                message: Inner validation failed
                errors:
                  amount:
                    - Amount is greater than maximum investment
                    - Amount is less than minimum investment
                  balance:
                    - User must have sufficient balance
                  plan:
                    - Plan must be active and accessible to user's region
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    ErrorInner:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-TXC-APIKEY
      description: API key authentication using signed requests

````