Skip to main content

Pages API

The Pages API provides access to static pages — about pages, landing pages, legal pages, and any content organized in a hierarchical page structure. Pages support parent-child relationships, translations, and tags.

Endpoints Overview

MethodEndpointDescription
GET/public/pagesList pages (paginated)
GET/public/pages/previewList page previews (lightweight)
GET/public/pages/{page_id}Get page by ID
GET/public/pages/by-slug/{slug}Get page by slug

List Pages

GET /public/pages

Returns a paginated list of pages.

Query Parameters

ParameterTypeRequiredDescription
statusstringNoFilter by status: draft, published, archived
languagestringNoFilter by language code
tagstringNoFilter by tag
fieldstringNoSort field
orderstringNoSort order: asc or desc
pageintegerNoPage number (default: 1)
limitintegerNoItems per page (default: 20)

Example Request

curl -X GET "https://api.adaptocms.com/public/pages?language=en&status=published" \
  -H "x-api-key: YOUR_API_KEY"

Example Response

{
  "items": [
    {
      "id": "page-001",
      "title": "About Us",
      "content": "<h2>Our Story</h2><p>We started in 2024...</p>",
      "slug": "about-us",
      "menu_label": "About",
      "parent_id": null,
      "language": "en",
      "tags": ["company"],
      "status": "published",
      "created_at": "2026-01-05T12:00:00",
      "updated_at": "2026-03-10T09:30:00",
      "published_at": "2026-01-06T08:00:00",
      "media_objects_placements": [],
      "translation_of_id": null,
      "custom_fields": {},
      "file_urls": null
    }
  ],
  "total": 8,
  "page": 1,
  "limit": 20,
  "pages": 1
}

List Pages Preview

GET /public/pages/preview

Returns a lightweight paginated list without content, custom_fields, file_urls, or media_objects_placements. Use this for building site navigation, menus, and sitemaps.

Accepts the same query parameters as GET /public/pages.

Example Request

curl -X GET "https://api.adaptocms.com/public/pages/preview?language=en" \
  -H "x-api-key: YOUR_API_KEY"

Example Response

{
  "items": [
    {
      "id": "page-001",
      "title": "About Us",
      "slug": "about-us",
      "menu_label": "About",
      "parent_id": null,
      "language": "en",
      "tags": ["company"],
      "status": "published",
      "created_at": "2026-01-05T12:00:00",
      "updated_at": "2026-03-10T09:30:00",
      "published_at": "2026-01-06T08:00:00",
      "translation_of_id": null
    }
  ],
  "total": 8,
  "page": 1,
  "limit": 20,
  "pages": 1
}

Use Case: Building a Navigation Menu

// Fetch all page previews and build a hierarchical menu
const { items: pages } = await fetch(
  `${BASE_URL}/public/pages/preview?language=en`,
  { headers: { 'x-api-key': API_KEY } }
).then(r => r.json());

// Build tree structure
const rootPages = pages.filter(p => p.parent_id === null);
const childPages = pages.filter(p => p.parent_id !== null);

const menu = rootPages.map(root => ({
  label: root.menu_label || root.title,
  slug: root.slug,
  children: childPages
    .filter(c => c.parent_id === root.id)
    .map(c => ({ label: c.menu_label || c.title, slug: c.slug }))
}));

Get Page by ID

GET /public/pages/{page_id}

Path Parameters

ParameterTypeRequiredDescription
page_idstring (UUID)YesThe unique identifier of the page

Example Request

curl -X GET "https://api.adaptocms.com/public/pages/page-001" \
  -H "x-api-key: YOUR_API_KEY"

Get Page by Slug

GET /public/pages/by-slug/{slug}

Retrieve a page by its URL-friendly slug. This is the primary method for page routing in front-end applications.

Path Parameters

ParameterTypeRequiredDescription
slugstringYesThe URL-friendly slug of the page

Example Request

curl -X GET "https://api.adaptocms.com/public/pages/by-slug/about-us" \
  -H "x-api-key: YOUR_API_KEY"

Use Case: Page Routing in Next.js

// pages/[slug].tsx
export async function getStaticProps({ params }) {
  const page = await fetch(
    `https://api.adaptocms.com/public/pages/by-slug/${params.slug}`,
    { headers: { 'x-api-key': process.env.ADAPTO_API_KEY } }
  ).then(r => r.json());

  return { props: { page }, revalidate: 60 };
}

export async function getStaticPaths() {
  const { items } = await fetch(
    'https://api.adaptocms.com/public/pages/preview?language=en',
    { headers: { 'x-api-key': process.env.ADAPTO_API_KEY } }
  ).then(r => r.json());

  return {
    paths: items.map(p => ({ params: { slug: p.slug } })),
    fallback: 'blocking'
  };
}