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

# Create Investment Application

> Creates a new investment application for a customer.

Creates a new investment application allowing customers to invest in a specific investment product with a specified number of units.

## Request Headers

<ParamField header="X-Auth-Token" type="string" required>
  The **JWT Access Token** obtained from the `/login` or `/refresh-token` endpoint.
</ParamField>

<ParamField header="x-idempotency-key" type="string" required>
  Unique idempotency key for the request to prevent duplicate processing.
</ParamField>

<ParamField header="x-fapi-auth-date" type="string" required>
  The date and time at which the request was initiated (ISO 8601 format).
</ParamField>

<ParamField header="x-fapi-customer-ip-address" type="string" required>
  The IP address of the customer making the request.
</ParamField>

<ParamField header="x-fapi-interaction-id" type="string" required>
  Unique identifier for the interaction/session.
</ParamField>

<ParamField header="Content-Type" type="string" required default="application/json">
  Must be `application/json`.
</ParamField>

## Request Body

<ParamField body="investmentProductId" type="string" required>
  The unique identifier (UUID) of the investment product to invest in.
</ParamField>

<ParamField body="numberOfUnitsToPurchase" type="number" required>
  The number of units to purchase for this investment.
</ParamField>

<ParamField body="userWalletId" type="string" required>
  The unique identifier (UUID) of the user wallet to use for the investment.
</ParamField>

<ParamField body="customerId" type="string" required>
  The unique identifier (UUID) of the customer making the investment.
</ParamField>

<ParamField body="customerName" type="string" required>
  The full name of the customer making the investment.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl --location --request POST 'https://test-investment-products-service.fincode.software/api/v1/user/apply' \
  --header 'X-Auth-Token: YOUR_JWT_ACCESS_TOKEN' \
  --header 'x-idempotency-key: unique-key-12345' \
  --header 'x-fapi-auth-date: 2024-01-15T10:30:00Z' \
  --header 'x-fapi-customer-ip-address: 192.168.1.1' \
  --header 'x-fapi-interaction-id: interaction-12345' \
  --header 'Content-Type: application/json' \
  --data '{
      "investmentProductId": "123e4567-e89b-12d3-a456-426614174000",
      "numberOfUnitsToPurchase": 100,
      "userWalletId": "123e4567-e89b-12d3-a456-426614174001",
      "customerId": "123e4567-e89b-12d3-a456-426614174002",
      "customerName": "John Doe"
  }'
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  const BASE_URL = 'https://test-investment-products-service.fincode.software/api/v1/user';

  async function createInvestmentApplication(accessToken, applicationData) {
    try {
      const response = await axios.post(
        `${BASE_URL}/apply`,
        {
          investmentProductId: applicationData.investmentProductId,
          numberOfUnitsToPurchase: applicationData.numberOfUnitsToPurchase,
          userWalletId: applicationData.userWalletId,
          customerId: applicationData.customerId,
          customerName: applicationData.customerName,
        },
        {
          headers: {
            'X-Auth-Token': accessToken,
            'x-idempotency-key': `key-${Date.now()}`,
            'x-fapi-auth-date': new Date().toISOString(),
            'x-fapi-customer-ip-address': '192.168.1.1',
            'x-fapi-interaction-id': `interaction-${Date.now()}`,
            'Content-Type': 'application/json',
          },
        }
      );

      return response.data.data;
    } catch (error) {
      console.error(
        'Failed to create investment application:',
        error.response?.data || error.message
      );
      throw error;
    }
  }

  ```
</CodeGroup>


## OpenAPI

````yaml POST /apply
openapi: 3.0.0
info:
  title: FinCode API
  version: v6
servers:
  - url: https://{tenant}.fincode.software/api/v6/services
    description: API v6
    variables:
      tenant:
        default: remitjunction
        description: Enter your tenant subdomain
  - url: https://{tenant}.fincode.software/api/v1/services
    description: API v1
    variables:
      tenant:
        default: finlend
        description: Enter your tenant subdomain
  - url: https://api.stag.songhaiexchange.io
    description: Songhai Exchange API
security: []
paths:
  /apply:
    post:
      summary: Create Investment Application
      description: Creates a new investment application.
      operationId: createInvestmentApplication
      parameters:
        - $ref: '#/components/parameters/platformHeader'
        - $ref: '#/components/parameters/uuidHeader'
        - in: header
          name: X-Auth-Token
          schema:
            type: string
          required: true
        - in: header
          name: x-idempotency-key
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                investmentProductId:
                  type: string
                numberOfUnitsToPurchase:
                  type: number
                userWalletId:
                  type: string
                customerId:
                  type: string
                customerName:
                  type: string
      responses:
        '200':
          description: Application created
      servers:
        - url: >-
            https://test-investment-products-service.fincode.software/api/v1/user
components:
  parameters:
    platformHeader:
      in: header
      name: platform
      schema:
        type: string
        default: fincode
      required: true
    uuidHeader:
      in: header
      name: uuid
      schema:
        type: string
        default: '200'
      required: true

````