Skip to main content

Overview

Many Falcon API endpoints return paginated results to handle large datasets efficiently. PSFalcon provides automatic pagination support through the -All parameter, allowing you to retrieve complete result sets without manual page handling.

How Pagination Works

From /home/daytona/workspace/source/private/Private.ps1:619-661, PSFalcon’s Invoke-Loop function handles pagination automatically:
1

Initial Request

PSFalcon makes the first API request with your specified parameters.
2

Response Analysis

The response includes pagination metadata:
  • total - Total number of results available
  • offset or after or next_token - Token for next page
  • Current count of retrieved results
3

Automatic Iteration

If -All is specified and more results exist, PSFalcon:
  • Calculates the next offset/token
  • Makes subsequent requests automatically
  • Outputs results as they’re received
  • Continues until all results are retrieved

Using the -All Parameter

The simplest way to retrieve all results:

Pagination Parameters

PSFalcon commands support various pagination parameters:
Maximum number of results per request.
When used with -All, sets the page size for each request.
Position to begin retrieving results (zero-based).
Automatically retrieve all available results.
Return only the total count, not the results.

Automatic Limit Optimization

From /home/daytona/workspace/source/private/Private.ps1:732-737, when using -All without -Limit:
This optimizes performance by reducing the number of API requests needed.

Pagination Token Types

From /home/daytona/workspace/source/private/Private.ps1:621-630, PSFalcon supports multiple pagination methods:
PSFalcon automatically detects and uses the appropriate pagination method.

Progress Tracking

From /home/daytona/workspace/source/private/Private.ps1:655, PSFalcon logs progress to the verbose stream:

Response Metadata

Every paginated response includes metadata:
The -RawOutput parameter is available on many commands to return the complete API response including metadata.

Endpoint-Specific Limits

From /home/daytona/workspace/source/public/devices.ps1:205-216, different endpoints have different maximum limits:
PSFalcon enforces these limits automatically and will adjust your -Limit value if it exceeds the maximum.

Manual Pagination

For advanced scenarios, you can manually control pagination:

Performance Considerations

1

Use Maximum Limit

Set -Limit to the maximum allowed for the endpoint to minimize API calls:
2

Filter Early

Apply filters to reduce the result set size:
3

Process Incrementally

For very large result sets, process batches instead of loading everything into memory:

Token Refresh During Pagination

From /home/daytona/workspace/source/private/Private.ps1:635-638, PSFalcon automatically refreshes authentication tokens during long pagination operations:

Handling Pagination Errors

From /home/daytona/workspace/source/private/Private.ps1:658-660:

Common Patterns

Scroll Endpoints

Some endpoints use scroll-based pagination with the after token:
From /home/daytona/workspace/source/private/Private.ps1:622-624, the after token is automatically detected and used.

Best Practices

1

Use -All for Complete Datasets

Let PSFalcon handle pagination automatically:
2

Set Appropriate Limits

Use maximum limits with -All for better performance:
3

Check Totals First for Planning

Use -Total to understand dataset size:
4

Handle Interruptions

Implement error handling for large operations:
5

Monitor Progress with -Verbose

Track long-running operations:
Most PSFalcon Get-* commands support pagination:
  • Get-FalconHost - Retrieve hosts with pagination
  • Get-FalconDetect - Retrieve detections with pagination
  • Get-FalconIncident - Retrieve incidents with pagination
  • Get-FalconAlert - Retrieve alerts with pagination
All use the same pagination patterns described in this guide.

Next Steps

Filtering

Learn FQL syntax to reduce result sets before pagination

Authentication

Understand token management during long operations