Distributor Tutorial
This tutorial demonstrates how to use the Distributor API to manage the complete lifecycle of deposits and withdrawals for investors in Spiko Funds. For a comprehensive API reference, please see the API Reference.
1. Create an Investor
First, let's create an investor profile for John Doe
.
curl -X POST "https://distributor-api.spiko.finance/v0/investors" \
-u "CLIENT_ID:CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe",
"details": {
"type": "individual",
"countryOfTaxResidence": "FR"
},
"country": "FR",
"city": "Paris",
"zipCode": "75001",
"address": "12 rue de Rivoli",
"dateOfBirth": "1999-08-24T14:15:22Z",
"placeOfBirth": "Paris"
}'
The API returns an INVESTOR_ID
which is required for subsequent operations.
2. Get the List of Available Share Classes
Retrieve the list of share classes available through the API.
curl -X GET "https://public-api.spiko.finance/share-classes/"
The response includes the SHARE_CLASS_ID
for the Spiko EU T-Bills Money Market Fund
, which we'll use for our investment.
3. Create a Subscription
Create a subscription order for €10,000 in the Spiko EU T-Bills Money Market Fund
.
curl -X POST "https://distributor-api.spiko.finance/v0/subscription-orders" \
-u "CLIENT_ID:CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"investorId": "INVESTOR_ID",
"amount": {
"value": "10000",
"currency": "EUR"
},
"shareClassId": "SHARE_CLASS_ID"
}'
The API returns a SUBSCRIPTION_ORDER_ID
and a WIRE_REFERENCE
. The WIRE_REFERENCE
must be included with the investor's wire transfer.
4. Process the Subscription Payment
The investor must transfer funds to the Fund's bank account using the provided WIRE_REFERENCE
. The bank account of the Fund is available in the share-classes
endpoint we used earlier. Once the Fund receives the transfer, the subscription order becomes valid. Monitor the order status using:
curl -X GET "https://distributor-api.spiko.finance/v0/subscription-orders/SUBSCRIPTION_ORDER_ID" \
-u "CLIENT_ID:CLIENT_SECRET" \
-H "Content-Type: application/json"
5. View the Portfolio
Monitor the investor's portfolio at any time:
curl -X GET "https://distributor-api.spiko.finance/v0/portfolios/INVESTOR_ID" \
-u "CLIENT_ID:CLIENT_SECRET" \
-H "Content-Type: application/json"
6. Register a Bank Account
Before initiating a redemption, register the investor's bank account:
curl -X POST "https://distributor-api.spiko.finance/v0/bank-accounts" \
-u "CLIENT_ID:CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"investorId": "INVESTOR_ID",
"currency": "EUR",
"accountNumber": "FRXXXXXXXXXXX",
"bic": "XXXXXXX"
}'
The API returns a BANK_ACCOUNT_ID
for use in redemption requests.
7. Create a Redemption Request
Submit a redemption request specifying the number of shares to redeem:
curl -X POST "https://distributor-api.spiko.finance/v0/redemption-orders" \
-u "CLIENT_ID:CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"investorId": "INVESTOR_ID",
"bankAccountId": "BANK_ACCOUNT_ID",
"sharesAmount": "100.50",
"shareClassId": "SHARE_CLASS_ID"
}'
8. Redemption Processing
The custodian bank processes the redemption and transfers the corresponding funds to the investor's registered bank account.
9. Access Accounting Statements
Retrieve historical accounting statements showing realized and unrealized gains:
curl -X GET "https://distributor-api.spiko.finance/v0/accounting-positions?investorId=INVESTOR_ID&shareClassId=SHARE_CLASS_ID&from=2024-01-01&to=2024-11-07" \
-u "CLIENT_ID:CLIENT_SECRET" \
-H "Content-Type: application/json"