List Portfolios
Retrieves all portfolios managed by the organization. This endpoint supports cursor-based pagination for efficient handling of large portfolio datasets.
Request URL
GET https://ddp.definitive.fi/v2/organization
Query Parameters
Parameter | Type | Required | Description | Default |
---|---|---|---|---|
limit | number | No | Maximum number of portfolios to return (1–100) | 10 |
cursor | string | No | Cursor for pagination (use nextCursor from last response) | - |
Example
// First page
const json = await AuthHelpers.signAndSend({
path: "/v2/organization",
method: "GET",
queryParams: { limit: "10" },
organizationId: "00000000-0000-0000-0000-000000000000",
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
});
// Subsequent page
const nextPageJson = await AuthHelpers.signAndSend({
path: "/v2/organization",
method: "GET",
queryParams: {
limit: "10",
cursor: "00000000-0000-0000-0000-000000000001"
},
organizationId: "00000000-0000-0000-0000-000000000000",
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
});
Response
{
organizationId: "00000000-0000-0000-0000-000000000000",
organizationName: "Example Organization",
createdAt: "2024-08-05T20:48:11.584Z",
data: [
{
portfolioId: "00000000-0000-0000-0000-000000000001",
portfolioName: "Trading Portfolio",
createdAt: "2024-08-05T20:48:11.584Z",
status: "ACTIVE"
}
// ... additional portfolios
],
pagination: {
hasMore: true,
nextCursor: "00000000-0000-0000-0000-000000000001",
limit: 10
}
}
Pagination
- First request: Omit the
cursor
parameter - Subsequent pages: Pass the
nextCursor
value from the previous response - End of data: When
hasMore
isfalse
, there are no more portfolios to return - Cursor value: Represents the last
portfolioId
from the response page
Pagination Loop Example
let cursor = null;
let allPortfolios = [];
do {
const queryParams = { limit: "50" };
if (cursor) queryParams.cursor = cursor;
const response = await AuthHelpers.signAndSend({
path: "/v2/organization",
method: "GET",
queryParams,
organizationId: process.env.ORG_ID,
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
});
allPortfolios.push(...response.data);
cursor = response.pagination.nextCursor;
} while (response.pagination.hasMore);