> ## Documentation Index
> Fetch the complete documentation index at: https://buttercms.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# API performance best practices

> ButterCMS API performance overview: query optimization, pagination, caching, CDN delivery, scaling, monitoring, and rate limits.

## Understanding the ButterCMS API architecture

ButterCMS provides a REST API that serves content through a globally distributed infrastructure. Content created through the dashboard or Write API is processed asynchronously (the cache is invalidated and the edge is re-primed in the background) and becomes available via read endpoints shortly after.

### Request flow

Read operations query cached content from edge locations, while write operations process through the primary API and trigger cache invalidation.

```mermaid theme={null}
flowchart TB
    A[Client Application]
    B[Edge Cache]
    C[API Server]
    D[Media Upload<br/>Validation<br/>Webhooks<br/>Cache Refresh]
    A -->|Request| B
    B -->|"Cache Hit (~50-100ms typical)"| A
    B -->|Cache Miss| C
    C -->|"Response (~200-500ms typical)"| B
    C --> D
```

## Performance topics

> [card] [Query Optimization](https://buttercms.com/docs/build-your-app/performance/query-optimization.md)
>
> How to use `exclude_body`, `levels`, and ordering to minimize response size and serialization overhead

> [card] [Pagination](https://buttercms.com/docs/build-your-app/performance/pagination.md)
>
> How to use page-based and offset-based pagination, infinite scroll, and archive page patterns

> [card] [Filtering Requests](https://buttercms.com/docs/build-your-app/performance/filtering-requests.md)
>
> How to filter by author, category, tag, and custom field values server-side

> [card] [Caching Strategies](https://buttercms.com/docs/build-your-app/performance/caching-strategies.md)
>
> Learn how to implement application-level caching for SSG, SSR, and SPA integrations

> [card] [CDN & Global Delivery](https://buttercms.com/docs/build-your-app/performance/cdn-global-delivery.md)
>
> Learn how ButterCMS serves content from 150+ edge locations worldwide

> [card] [Scaling for High Traffic](https://buttercms.com/docs/build-your-app/performance/scaling-high-traffic.md)
>
> Learn how to implement circuit breakers, graceful degradation, and traffic spike strategies

> [card] [Monitoring API Usage](https://buttercms.com/docs/build-your-app/performance/monitoring-api-usage.md)
>
> Learn how to track read/write API consumption and identify optimization opportunities

> [card] [Rate Limits & Throttling](https://buttercms.com/docs/build-your-app/performance/rate-limits-throttling.md)
>
> Learn how to handle rate-limited responses and avoid hitting API throttle limits

## Performance checklist

> [accordion] Before going to production
>
> * [ ] Use `exclude_body=true` for all listing endpoints
> * [ ] Set appropriate `levels` parameter (default to 1-2)
> * [ ] Implement pagination with 10-25 items per page
> * [ ] Add application-level caching for frequently accessed content
> * [ ] Set up error handling with retry logic
> * [ ] Configure webhooks for cache invalidation

> [accordion] Monitoring & optimization
>
> * [ ] Monitor API response times in your application
> * [ ] Track API usage in the ButterCMS Analytics dashboard (see [Monitoring API Usage](https://buttercms.com/docs/build-your-app/performance/monitoring-api-usage.md))
> * [ ] Review and optimize queries that are slower than expected for your use case
> * [ ] Consider pre-fetching content for predictable navigation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.