Investments

Investments are a key component of financial services, allowing customers to grow their wealth through various financial instruments. On this page, we’ll dive into the different investment endpoints you can use to manage investments programmatically. We'll look at how to query, create, update, and delete investment records.

The investment model

The investment model contains all the information related to an investment, including the type of investment, amount, and performance details.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the investment record.

  • Name
    customer_id
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    investment_type
    Type
    string
    Description

    Type of investment (e.g., stock, bond, mutual fund).

  • Name
    amount
    Type
    number
    Description

    Amount invested.

  • Name
    performance
    Type
    string
    Description

    Performance details of the investment.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the investment record was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the investment record was last updated.


GET/v1/investments

List all investments

This endpoint allows you to retrieve a paginated list of all your investment records. By default, a maximum of ten records are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of investment records returned.

  • Name
    customer_id
    Type
    string
    Description

    Only show records for the specified customer.

  • Name
    investment_type
    Type
    string
    Description

    Only show records with the specified investment type.

Request

GET
/v1/investments
curl -G https://api.finx.ai/v1/investments \
  -H "Authorization: Bearer {token}" \
  -d limit=10

Response

{
  "has_more": false,
  "data": [
    {
      "id": "xgQQXg3hrtjh7AvZ",
      "customer_id": "WAz8eIbvDR60rouK",
      "investment_type": "stock",
      "amount": 10000,
      "performance": "10% annual return",
      "created_at": 705103200,
      "updated_at": 705103200
    },
    {
      "id": "hSIhXBhNe8X1d8Et"
      // ...
    }
  ]
}

POST/v1/investments

Create an investment

This endpoint allows you to add a new investment record. You need to provide the customer ID, investment type, amount, and performance details to create an investment record.

Required attributes

  • Name
    customer_id
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    investment_type
    Type
    string
    Description

    Type of investment (e.g., stock, bond, mutual fund).

  • Name
    amount
    Type
    number
    Description

    Amount invested.

  • Name
    performance
    Type
    string
    Description

    Performance details of the investment.

Request

POST
/v1/investments'
curl https://api.finx.ai/v1/investments \
  -H "Authorization: Bearer {token}" \
  -d 'customer_id'="WAz8eIbvDR60rouK" \
  -d 'investment_type'="stock" \
  -d 'amount'=10000 \
  -d 'performance'="10% annual return"

Response

{
  "id": "xgQQXg3hrtjh7AvZ",
  "customer_id": "WAz8eIbvDR60rouK",
  "investment_type": "stock",
  "amount": 10000,
  "performance": "10% annual return",
  "created_at": 705103200,
  "updated_at": 705103200
}

GET/v1/investments/:id

Retrieve an investment

This endpoint allows you to retrieve an investment record by providing the record id. Refer to the list at the top of this page to see which properties are included with investment objects.

Request

GET
/v1/investments/xgQQXg3hrtjh7AvZ
curl https://api.finx.ai/v1/investments/xgQQXg3hrtjh7AvZ \
  -H "Authorization: Bearer {token}"

Response

{
  "id": "xgQQXg3hrtjh7AvZ",
  "customer_id": "WAz8eIbvDR60rouK",
  "investment_type": "stock",
  "amount": 10000,
  "performance": "10% annual return",
  "created_at": 705103200,
  "updated_at": 705103200
}

PUT/v1/investments/:id

Update an investment

This endpoint allows you to perform an update on an investment record. Examples of updates are changing the investment type, updating the amount, or modifying the performance details.

Optional attributes

  • Name
    investment_type
    Type
    string
    Description

    Updated type of investment.

  • Name
    amount
    Type
    number
    Description

    Updated amount invested.

  • Name
    performance
    Type
    string
    Description

    Updated performance details of the investment.

Request

PUT
/v1/investments/xgQQXg3hrtjh7AvZ
curl -X PUT https://api.finx.ai/v1/investments/xgQQXg3hrtjh7AvZ \
  -H

"Authorization: Bearer {token}" \
  -d 'amount'=15000

Response

{
  "id": "xgQQXg3hrtjh7AvZ",
  "customer_id": "WAz8eIbvDR60rouK",
  "investment_type": "stock",
  "amount": 15000,
  "performance": "10% annual return",
  "created_at": 705103200,
  "updated_at": 705103200
}

DELETE/v1/investments/:id

Delete an investment

This endpoint allows you to delete your investment records in Fin X. Note: This will permanently delete the record and all its data — ensure this is the desired action before proceeding.

Request

DELETE
/v1/investments/xgQQXg3hrtjh7AvZ
curl -X DELETE https://api.finx.ai/v1/investments/xgQQXg3hrtjh7AvZ \
  -H "Authorization: Bearer {token}"

Was this page helpful?