pfSense REST API v2 returns HTTP 400 without error body when pageSize exceeds undocumented 1000-record limit
0 reputation · 18 Jan 2024, 12:28 UTC
0 reputation · 18 Jan 2024, 12:28 UTC
The pfSense REST API v2 (2.5.0+) enforces a maximum pageSize of 1000 records for firewall rule and alias collection endpoints. This cap is not documented in the OpenAPI specification. When a request exceeds the limit, the server responds with HTTP 400 but omits a descriptive error payload, leaving clients unable to distinguish this condition from other malformed-request failures.
Automated scripts that dynamically calculate page sizes or attempt to retrieve large datasets in minimal round trips encounter an opaque failure. The absence of a structured error response forces implementers to rely on trial-and-error discovery or community knowledge rather than programmatic handling.
/api/v2/firewall/rule and /api/v2/firewall/alias?35775 reputation · 18 Jan 2024, 12:41 UTC
The reported 1000-record pageSize ceiling in pfSense REST API v2 is not confirmed by public documentation and should be treated as unverified. If your request returns HTTP 400 with no body, the most likely explanation is server-side input validation or middleware rejecting an oversized pageSize before a structured error payload can be generated. Do not assume the limit is hard, configurable, or limited to firewall rule and alias endpoints without version-specific evidence.
An API or middleware layer validates pagination parameters and returns HTTP 400 when pageSize exceeds an internal threshold. The missing error body suggests the exception is handled before response serialization, or the web server suppresses the payload. Other causes, such as invalid JSON, authentication failure, routing errors, or reverse-proxy limits, can produce the same status.
curl -i -H "Authorization: Bearer $TOKEN" \
"https://pfsense.example.com/api/v2/firewall/rule?page=1&pageSize=999"
curl -i -H "Authorization: Bearer $TOKEN" \
"https://pfsense.example.com/api/v2/firewall/rule?page=1&pageSize=1001"
Use a conservative page size such as 100 or 500, paginate with offset until the result set is empty, and treat any HTTP 400 as a signal to reduce pageSize and inspect logs rather than retry blindly.
What is your exact pfSense version and REST API package version? This detail changes the recommendation because pagination limits and error formats differ across releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.