Create Asset
const url = 'https://indepai.app/api/v1/assets';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Vanguard FTSE All-World UCITS ETF","assetType":"stock","tickerSymbol":"VWCE.DE","isin":"IE00BK5BQT80","quantity":50,"purchasePrice":110.5,"currentPrice":118.4,"purchaseDate":"2024-01-15","currency":"EUR","expenseRatio":0.22,"geographicRegion":"Global","sector":"Technology","address":"ul. Marszałkowska 1","city":"Warsaw","countryCode":"PL","categoryId":"550e8400-e29b-41d4-a716-446655440000","portfolioId":"550e8400-e29b-41d4-a716-446655440000","sellWillingnessTier":"gladly_sell","bondFaceValue":100,"bondFirstYearRate":6,"bondMargin":1,"bondRateType":"fixed","bondCapitalization":"annual_compound","bondMaturityDate":"2033-05-25","bondSeries":"EDO0335","bondEarlyRedemptionFee":0.7}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://indepai.app/api/v1/assets \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Vanguard FTSE All-World UCITS ETF", "assetType": "stock", "tickerSymbol": "VWCE.DE", "isin": "IE00BK5BQT80", "quantity": 50, "purchasePrice": 110.5, "currentPrice": 118.4, "purchaseDate": "2024-01-15", "currency": "EUR", "expenseRatio": 0.22, "geographicRegion": "Global", "sector": "Technology", "address": "ul. Marszałkowska 1", "city": "Warsaw", "countryCode": "PL", "categoryId": "550e8400-e29b-41d4-a716-446655440000", "portfolioId": "550e8400-e29b-41d4-a716-446655440000", "sellWillingnessTier": "gladly_sell", "bondFaceValue": 100, "bondFirstYearRate": 6, "bondMargin": 1, "bondRateType": "fixed", "bondCapitalization": "annual_compound", "bondMaturityDate": "2033-05-25", "bondSeries": "EDO0335", "bondEarlyRedemptionFee": 0.7 }'Add a new asset to the portfolio
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Name of the asset
Example
Vanguard FTSE All-World UCITS ETFType of asset
Example
etfStock/ETF ticker symbol
Example
VWCE.DEInternational Securities Identification Number
Example
IE00BK5BQT80Number of units/shares held
Example
50Purchase price per unit
Example
110.5User-supplied current price per unit (defaults to purchase price)
Example
118.4Date of purchase
Example
2024-01-15Currency of the asset
Example
EURAnnual expense ratio for ETFs/funds (%)
Example
0.22Geographic region of the asset
Example
GlobalIndustry sector
Example
TechnologyStreet address for real_estate assets
Example
ul. Marszałkowska 1City for real_estate assets
Example
WarsawCountry (ISO code or free text) for real_estate assets
Example
PLCategory ID for grouping assets
Example
550e8400-e29b-41d4-a716-446655440000Target portfolio (defaults to the user’s default portfolio)
Example
550e8400-e29b-41d4-a716-446655440000Willingness to sell this asset to fund living costs
Example
sell_if_neededBond face value per unit (e.g. EDO = 100 PLN)
Example
100Fixed year-1 coupon rate (% p.a.)
Example
6Margin over the reference rate for year 2+ (%)
Example
1How the bond’s coupon rate is determined after year 1
Example
cpi_plus_marginHow bond interest is capitalized or paid out
Example
annual_compoundBond maturity date
Example
2033-05-25Bond series identifier
Example
EDO0335Early redemption fee per unit (native currency)
Example
0.7Responses
Section titled “Responses”Asset created
object
object
Asset ID
Owner user ID
Owning portfolio ID
Type of financial asset
Willingness to sell this asset to fund living costs
How the bond’s coupon rate is determined after year 1
How bond interest is capitalized or paid out
object
Timestamp in ISO 8601 format
Unique identifier (UUID v4)
Timestamp in ISO 8601 format
Timestamp in ISO 8601 format
Timestamp in ISO 8601 format
object
Timestamp in ISO 8601 format
Example
{ "success": true, "data": { "id": "550e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", "portfolioId": "550e8400-e29b-41d4-a716-446655440000", "assetType": "stock", "mortgageType": "fixed", "sellWillingnessTier": "gladly_sell", "bondRateType": "fixed", "bondCapitalization": "annual_compound", "marketQuote": { "asOf": "2024-01-15T10:30:00Z", "status": "fresh" }, "categoryId": "550e8400-e29b-41d4-a716-446655440000", "lastUpdated": "2024-01-15T10:30:00Z", "createdAt": "2024-01-15T10:30:00Z", "updatedAt": "2024-01-15T10:30:00Z" }, "meta": { "timestamp": "2024-01-15T10:30:00Z" }}Validation error
object
Always false for error responses
Error type
Machine-readable error code
Detailed validation errors
object
Path to the invalid field
Error message
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}Unauthorized
object
Always false for error responses
Error type
Machine-readable error code
Detailed validation errors
object
Path to the invalid field
Error message
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}