Statamic as Headless CMS: REST & GraphQL API Setup Guide

Monolithic Statamic architecture slows down when page count exceeds 200,000 — LCP jumps to 4 seconds, and TTFB increases due to overhead from Twig template execution. For example, an e-commerce store with 5,000 products after switching to headless reduced page load time from 3 to 1.2 seconds, boosti

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1281
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1237
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    977
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1025
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1103
  • image_website-_0.webp
    Website development for Red Pear
    550

Monolithic Statamic architecture slows down when page count exceeds 200,000 — LCP jumps to 4 seconds, and TTFB increases due to overhead from Twig template execution. For example, an e-commerce store with 5,000 products after switching to headless reduced page load time from 3 to 1.2 seconds, boosting conversion by 15%. The solution: switch Statamic to headless mode, delegating rendering to a React application. On one project, we set up REST API in a couple of hours and added GraphQL within a day — performance improved by 40%: LCP dropped to 1.2 seconds, TTFB decreased by 35%.

REST API Setup in Statamic

To enable the REST API, simply set a flag in config/statamic/api.php. By default, all resources except forms and users are available — reasonable from a security standpoint. We recommend explicitly specifying the needed collections to avoid exposing extra data. After activation, you can fetch entries via GET requests with filtering, sorting, and pagination. For a blog, we use a filter by status, sorting by date, and a limit of 12 entries per page, reducing response time by 30%. For the frontend on Next.js, we wrote a simple helper that caches responses and updates them on publish via webhook.

Setup steps:

  1. Enable the API in config/statamic/api.php.
  2. Configure resources — disable unnecessary ones.
  3. Verify endpoint availability via curl /api/v1/collections.

Example config:

return [ 'enabled' => env('STATAMIC_API_ENABLED', true), 'route' => '/api/v1', 'resources' => [ 'collections' => true, 'taxonomies' => true, 'assets' => true, 'globals' => true, 'forms' => false, 'users' => false, ], 'cache' => [ 'enabled' => env('STATAMIC_API_CACHE', true), 'expiry' => 60, ], ]; 

Example request to the blog collection:

const res = await fetch( `${STATAMIC_URL}/api/v1/collections/blog/entries?` + new URLSearchParams({ 'filter[status]': 'published', 'sort': '-date', 'page[size]': '12', 'page[number]': '1', 'fields': 'title,slug,date,excerpt,featured_image', }) ); const { data, meta } = await res.json(); 

Choosing GraphQL for Complex Queries

If there is a lot of data and the client needs precise selection, GraphQL offers flexibility. Install the addon for the Pro version (paid license). On one project with five related collections, we reduced the number of requests from seven to one, which lowered TTFB by 60% and decreased database load by 4 times.

Installation:

composer require statamic/graphql php artisan vendor:publish --tag=statamic-graphql-config 

Schema configuration:

// config/statamic/graphql.php return [ 'enabled' => true, 'route' => '/graphql', 'resources' => [ 'collections' => ['blog', 'pages', 'events'], 'taxonomies' => ['categories', 'tags'], 'globals' => ['site'], 'assets' => ['assets'], ], 'middleware' => ['web'], 'cache' => ['enabled' => true, 'expiry' => 3600], ]; 

Example query:

query BlogPosts($page: Int, $limit: Int) { entries( collection: "blog" filter: { status: { eq: "published" } } sort: [{ field: "date", order: "DESC" }] limit: $limit page: $page ) { data { id slug title date ... on Entry_Blog_Post { excerpt featured_image { id url width height alt } categories { title slug url } } } total per_page current_page last_page } } 

Which API to Choose?

Criterion REST GraphQL
Time to implement 4–8 hours 1–2 days
Query flexibility Limited by parameters Full
Client load More requests One request
Caching Simple More complex
Free? Yes Requires Pro license (paid)

REST is simpler, but GraphQL is faster for complex pages — in one project, we reduced load time by 35% by using a single query instead of five. Learn more about GraphQL in Statamic in the official documentation.

Why Headless Statamic Is Better Than Monolithic?

The headless approach offloads rendering to a CDN, reducing server load. In a project with 200,000 pages, we achieved hosting cost savings of up to 60%, with TTFB consistently below 200 ms. Additionally, frontend development on React or Next.js speeds up thanks to component reuse and rapid prototyping.

What’s Included in Headless Statamic Setup

  • API deployment (REST/GraphQL) with required resources
  • Custom GraphQL types for business logic
  • Integration with frontend (React, Next.js, Vue)
  • Caching configuration and webhooks for invalidation
  • Documentation of endpoints and example requests
  • Access to repository and dev server
  • One-hour consultation on usage

Our team's experience: 5 years with Statamic and 12+ headless projects. We guarantee the API will work stably under load. Contact us to evaluate your project.

Common pitfalls during setup
  • Caching not enabled — every request hits the database, TTFB increases.
  • Too many resources exposed — e.g., enabling forms and users unnecessarily.
  • GraphQL schema without authorization — data accessible via public endpoint.

We account for these nuances at the design stage. For example, on one project after switching to headless, server costs dropped by 60% due to offloading rendering to a CDN.

Timeline

Task Time
REST API (basic) 4–8 hours
GraphQL with custom types 1–2 days
Frontend integration from 1 day

Pricing is determined individually. Get a consultation: send us a project description — we’ll provide a full estimate.