Portfolio
Portfolio balances, fee components, and USDL transfers.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/portfolio/ | Portfolio summary |
GET | /api/portfolio/component | Portfolio component |
POST | /api/portfolio/transfer | Create 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| None | - | No | No parameters for this endpoint. |
Response
// See @loafmarkets/shared-types for the response type
type Response = Record<string, unknown>;Example response:
{
"success": true
}Errors
| Status | Code | Description |
|---|---|---|
400 | validation_error | Request failed schema validation. |
401 | unauthorized | Missing or invalid authentication. |
404 | not_found | Resource not found (where applicable). |
500 | internal_error | Unexpected 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| None | - | No | No parameters for this endpoint. |
Response
// See @loafmarkets/shared-types for the response type
type Response = Record<string, unknown>;Example response:
{
"success": true
}Errors
| Status | Code | Description |
|---|---|---|
400 | validation_error | Request failed schema validation. |
401 | unauthorized | Missing or invalid authentication. |
404 | not_found | Resource not found (where applicable). |
500 | internal_error | Unexpected 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
| Parameter | Type | Required | Description |
|---|---|---|---|
toAddress | string | Yes | (body) Destination 0x Ethereum address (40 hex chars). |
cryptoAmount | number | Yes | (body) USDL amount to withdraw (max 2 decimal places). |
nonce | string | Yes | (body) 32-character hex nonce. |
deadline | number | Yes | (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
| Status | Code | Description |
|---|---|---|
400 | validation_error | Request failed schema validation. |
401 | unauthorized | Missing or invalid authentication. |
404 | not_found | Resource not found (where applicable). |
500 | internal_error | Unexpected server error. |
Requires Privy JWT authentication.
Last updated on