Pack Content Management API

Content management is a core part of Pack — the very reason Pack exists is so you can easily and flexibly manage complex content on your storefront. On this page, we'll dive into the different content management endpoints you can use to manage your content programmatically. Plus, we'll look at all our GraphQL endpoints for managing your content.


Authentication

All GraphQL Admin API queries need a valid Pack access token.

Add your token as an Authorization header to all API queries.

If you use the Secret Token, you'll have permission to read and write through the API. If you use the Public Token, you'll only have read access.

The @pack/client package offers a client for working with the Pack GraphQL API.

import { PackClient } from '@pack/client';

const packClient = new PackClient({
  apiUrl: 'https://app.packdigital.com/graphql',
  token: '{YOUR_SECRET_TOKEN}',
  contentEnvironment: 'content_environment_handle',
});

const query = `
query {
  siteSettings {
    settings
    seo {
      title
      description
      keywords
    }
  }
}
`;

async function fetchSiteSettings() {
    const response = await packClient.fetch(query);
    console.log(response.data.siteSettings);
}

fetchSiteSettings();

Page

A page is structured data that will hold information like title, description, SEO data, and most importantly its sections – the building blocks of your site's content. When navigating to routes in your storefront under the /pages/ template, it will use this page data to get content.

Queries

Mutations


Product Page

A product page is structured data that will hold information like title, description, SEO data, and most importantly its sections – the building blocks of your site's content. When navigating to routes in your storefront under the /products/ template, it will use this page data to get content.

Queries

Mutations


Collection Page

A collection page is structured data that will hold information like title, description, SEO data, and most importantly its sections – the building blocks of your site's content. When navigating to routes in your storefront under the /collections/ template, it will use this page data to get content.

Queries

Mutations


Blog

A blog is structured data that will hold information like title, description, SEO data, and most importantly its sections – the building blocks of your site's content. When navigating to routes in your storefront under the /blogs/ template, it will use this page data to get content.

Queries

Mutations


Article

An article is structured data that will hold information like title, description, SEO data, and most importantly its sections – the building blocks of your site's content. When navigating to routes in your storefront under the /articles/ template, it will use this page data to get content.

Queries

Mutations


Section

A section is the structured data that houses the content for your page. The section's data model is derived from its corresponding component schema in your code base.

Queries

Mutations

Site Settings

This is the storefront site settings.

Queries

Mutations


Schedules

Schedules are used to publish or unpublish content at a specific time in the future.

Queries

Mutations


Templates

A template is a container for template sections and is used to repeat these sections throughout pages that use the template.

Queries

Mutations

Was this page helpful?