Skip to Content
API ReferencePortfolio

Portfolio

Portfolio balances, fee components, and USDL transfers.

Endpoints

MethodPathDescription
GET/api/portfolio/Portfolio summary
GET/api/portfolio/componentPortfolio component
POST/api/portfolio/transferCreate transfer

Portfolio summary

GET /api/portfolio/

Returns portfolio page data for the authenticated user.

Request

import axios from 'axios'; const response = await axios.get('https://api.loafmarkets.com/api/portfolio/', { headers: { Authorization: `Bearer ${process.env.LOAF_PRIVY_JWT}` }, }); console.log(response.data);

Parameters

ParameterTypeRequiredDescription
None-NoNo parameters for this endpoint.

Response

// See @loafmarkets/shared-types for the response type type Response = Record<string, unknown>;

Example response:

{ "success": true }

Errors

StatusCodeDescription
400validation_errorRequest failed schema validation.
401unauthorizedMissing or invalid authentication.
404not_foundResource not found (where applicable).
500internal_errorUnexpected server error.

Requires Privy JWT authentication.


Portfolio component

GET /api/portfolio/component

Returns fee schedule and component data used by the portfolio UI.

Request

import axios from 'axios'; const response = await axios.get('https://api.loafmarkets.com/api/portfolio/component', { headers: { Authorization: `Bearer ${process.env.LOAF_PRIVY_JWT}` }, }); console.log(response.data);

Parameters

ParameterTypeRequiredDescription
None-NoNo parameters for this endpoint.

Response

// See @loafmarkets/shared-types for the response type type Response = Record<string, unknown>;

Example response:

{ "success": true }

Errors

StatusCodeDescription
400validation_errorRequest failed schema validation.
401unauthorizedMissing or invalid authentication.
404not_foundResource not found (where applicable).
500internal_errorUnexpected server error.

Requires Privy JWT authentication.


Create transfer

POST /api/portfolio/transfer

Initiates a USDL transfer / withdrawal for the authenticated user.

Request body

Type: TransferRequestBody (@loafmarkets/shared-types)

interface TransferRequestBody { toAddress: string; cryptoAmount: number; nonce: string; deadline: number; }

Signed via the Privy session signer (same flow as orders).

Request

import axios from 'axios'; import type { TransferRequestBody } from '@loafmarkets/shared-types'; const body: TransferRequestBody = { toAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', cryptoAmount: 250.5, nonce: 'c3d4e5f6789012345678901234abcdef', deadline: 1893456000, }; const response = await axios.post('https://api.loafmarkets.com/api/portfolio/transfer', body, { headers: { Authorization: `Bearer ${process.env.LOAF_PRIVY_JWT}` }, }); console.log(response.data);

Parameters

ParameterTypeRequiredDescription
toAddressstringYes(body) Destination 0x Ethereum address (40 hex chars).
cryptoAmountnumberYes(body) USDL amount to withdraw (max 2 decimal places).
noncestringYes(body) 32-character hex nonce.
deadlinenumberYes(body) Unix timestamp (seconds) for signature expiry.

Response

// See @loafmarkets/shared-types for the response type type Response = Record<string, unknown>;

Example response:

{ "success": true }

Errors

StatusCodeDescription
400validation_errorRequest failed schema validation.
401unauthorizedMissing or invalid authentication.
404not_foundResource not found (where applicable).
500internal_errorUnexpected server error.

Requires Privy JWT authentication.

Last updated on