API
Headless API
Svalla delivers content through a powerful GraphQL API — query pages, filter content, search, and integrate with any frontend framework.
GraphQL Overview
A flexible query language for your content
Svalla uses GraphQL as its API layer. Unlike REST APIs where each endpoint returns a fixed structure, GraphQL lets you request exactly the data you need in a single query.
Benefits:
- No over-fetching — request only the fields you need, reducing response size
- Single endpoint — all queries go through one URL (
/graphql) - Strongly typed — the schema defines all available types and fields, with built-in documentation
- Nested queries — fetch a page with all its sections, categories, and related content in one request
Authentication
Secure API access
The API uses token-based authentication:
- API tokens — generate tokens in Settings → API for your frontend application
- Bearer authentication — include the token in the Authorization header:
Bearer your-token - Scoped access — tokens can be restricted to specific paths and operations
Public queries (fetching published content) may not require authentication depending on your configuration, while mutations (creating form submissions, member login) always require proper authentication.
Querying Content
Fetch pages, posts, and sections
The most common API operations for your frontend:
- Get a page by URL — fetch a specific page using its slug, with all sections and content
- List posts — retrieve a list of posts from a post type, with pagination
- Get homepage — dedicated query for the homepage content
- Fetch blocks — retrieve global blocks (header, footer) for layouts
- Get translations — fetch i18n strings for UI elements
- Sitemap — retrieve the sitemap data for SEO
Each query returns structured data following the section definitions you created in the Builder. Your frontend maps this data to components.
Filtering & Search
Find exactly what you need
The API provides powerful filtering capabilities:
- Category filters — filter posts by one or multiple categories
- Property filters — filter by custom property values (price range, date, boolean flags)
- Full-text search — search across all content fields with language support
- Combined filters — combine category, property, and text filters with AND/OR logic
- Sorting — order results by date (newest/oldest), title (A-Z), or random
These filters enable dynamic content experiences on your frontend: blog archives with category filtering, product catalogs with property-based search, and more.
Pagination
Handle large content sets efficiently
Content list queries support pagination for handling large collections:
- Limit — specify how many items to return per page
- Offset — skip a number of items for navigating pages
- Total count — the API returns the total number of matching items
With total count and limit, your frontend can calculate the number of pages and build pagination controls (previous, next, page numbers) for content listings.
Frontend Integration
Connect with any framework
Svalla's GraphQL API works with any frontend technology that can make HTTP requests. Common integrations:
- Next.js — server-side rendering with Apollo Client or urql for optimal performance and SEO
- React — client-side rendering with any GraphQL client
- Vue / Nuxt — use Vue Apollo or any GraphQL library
- Mobile apps — native iOS/Android apps consuming the same API
- Static sites — generate static pages at build time using API data
The recommended setup for web applications is Next.js with server-side rendering, which provides the best combination of performance, SEO, and developer experience.