Key optimization parameters
1. The exclude_body parameter
The exclude_body=true parameter reduces response size by 50-70% for blog post listing operations. This is one of the most impactful optimizations you can make.
When to Use:
- Blog post listing pages
- Archive pages
- Search results
- RSS feed generation
- Related posts widgets
- Individual post pages (you need the body)
- Full-text search implementations
- Content that displays the full article
2. The levels parameter
The levels parameter controls reference field depth in API responses, balancing data completeness with response size and performance.
Configuration:
- Default:
levels=2covers most page display scenarios - Range: 1-5 (values outside this range are automatically adjusted)
- Level 1: Reference fields return API URIs only (minimal data transfer)
- Level 2+: Reference fields return complete object data
- Level 5 (max): Returns URIs for any remaining references beyond specified depth
| Use Case | Recommended Level | Reason |
|---|---|---|
| Navigation menus | 1 | Only need slugs/titles |
| Page listings | 1 | Minimal reference data needed |
| Standard page display | 2 (default) | Most common scenario |
| Pages with nested refs | 3-4 | Complex content structures |
| Deep reference chains | 5 | Maximum depth needed |
3. Field filtering
Filter content server-side to fetch only what you need — by author, category, tag, or any custom field value. See Filtering Requests for the full reference with examples for blog posts, pages, and collections.4. Ordering
Order results server-side instead of sorting client-side: Available Order Fields:published- Publication dateupdated- Last update date- Custom content fields
- Ascending (default):
order=published - Descending:
order=-published(prepend-)
5. Pagination
Use appropriate page sizes and pagination methods to avoid oversized responses. The recommended range is 10-25 items per request for optimal performance.Pagination
Page-based and offset-based pagination, infinite scroll, and archive page patterns
Filtering Requests
Filter by author, category, tag, and custom field values
Serialization performance
When cached content is unavailable (cache miss), the API must serialize both the requested content and all content referenced at the specified depth. For list endpoints, this increases processing time significantly. Example Problem: Requesting 100 pages withlevels=2 may require serializing 100+ individual objects plus their references.
Recommendation: Always use levels=1 for list operations, then fetch full details for individual items when needed.
Query optimization patterns
Pattern 1: two-stage fetching
Fetch lists with minimal data, then fetch full details on demand:Pattern 2: parallel requests
Fetch independent data in parallel:Pattern 3: selective field loading
Only request the data you need for each view:Pattern 4: caching query results
Cache optimized query results for repeated access:Response size optimization
Estimating response sizes
| Content Type | Typical Size | With exclude_body |
|---|---|---|
| Blog post (full) | 5-50KB | 1-5KB |
| Page (simple) | 2-10KB | N/A |
| Page (with components) | 10-100KB | N/A |
| Collection item | 0.5-5KB | N/A |
Size reduction strategies
- Use
exclude_body=truefor all listing endpoints - Use
levels=1for navigation and lists - Limit
page_sizeto 10-25 items - Filter server-side instead of fetching everything
Search optimization
When using the search endpoint, keep these optimizations in mind: Search Limitations:- Only the direct content of pages is searched
- References are excluded from search but appear in results
- Maximum query length: 100 characters
Query optimization checklist
Before building features
Before building features
- Identify the minimum data needed for each view
- Plan which endpoints to use for each feature
- Consider caching strategy for each query type
During development
During development
- Use
exclude_body=truefor all blog listings - Set appropriate
levels(default to 1 for lists) - Use server-side filtering instead of client-side
- Order results server-side with
orderparameter - Implement parallel fetching for independent data
Performance testing
Performance testing
- Measure response times with real data volumes
- Test with cache cold and warm states
- Monitor response sizes stay well under 10MB
- Verify minimal data for each view type