Skip to main content

Pagination & Filtering

API endpoints returning list collections (such as transaction history) support pagination and query-based filtering to optimize response payloads and application performance.


🔢 Pagination

To paginate results, include the following Query Parameters in your request:

  • page: The page number to retrieve (starts at 1, default: 1).
  • per_page: The number of items to return per page (default: 10).

Paginated Response Structure

Endpoints supporting pagination include a pagination object in the JSON response payload:

{
"success": true,
"data": [ ... ],
"pagination": {
"page": 1,
"per_page": 10,
"total": 45
}
}
  • page: The current active page.
  • per_page: The maximum number of records requested per page.
  • total: The total count of matching records available in the database.

🔍 Advanced Filtering

The transaction history endpoint /api/transactions/:slug supports the following query parameters:

1. Filter by Stock Code (stock_code)

Retrieve transactions only for a specific stock ticker symbol (uppercase): GET /api/transactions/bangnh?stock_code=FPT

2. Filter by Broker Code (broker)

Filter transactions associated with brokerage accounts at a particular institution: GET /api/transactions/bangnh?broker=SSI

3. Filter by Transaction Type (type)

Filter transactions to either buy or sell actions:

  • buy: Buy transactions.
  • sell: Sell transactions.

GET /api/transactions/bangnh?type=buy

4. Filter by Date Range (start_date & end_date)

Filter transactions executed within a specific timeframe (Format: YYYY-MM-DD): GET /api/transactions/bangnh?start_date=2026-01-01&end_date=2026-05-25