API & queries
- Use fields to request only the fields you need; this reduces payload size and improves performance.
- Use filters for conditions (e.g.
publishedAt[less_than]2025-01-01). - Use orders for sort order (e.g.
-publishedAt for newest first). - Use limit / offset for paging, or
getAllContents when you need everything.
Preview & drafts
- Fetch drafts by adding draftKey to the query; the key is in the preview URL from the dashboard.
- A dedicated preview route (e.g.
/news/draft/[id]?draftKey=xxx) makes it easy to check content before publishing.
Cache & webhook
- Cache API responses (e.g. Nitro
cachedEventHandler, CDN Cache-Control) to reduce data transfer. - Use a Webhook (custom notification) to POST to your URL on content changes, then invalidate cache or trigger a rebuild so updates appear quickly.
Images & media
- Append query params to image URLs (e.g.
?w=800&q=80) for resize and quality. - Custom domain settings let you serve media from your own domain.