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.
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
-
- Name
page(id: ID!, version: Version)
- Type
- Page
- Description
-
Returns a page by ID in a draft or published state.
Learn more
-
- Name
pageByHandle(handle: String!, version: Version)
- Type
- Page
- Description
-
Returns a page by handle in a draft or published state.
Learn more
-
- Name
pages(after: String, before: String, first: Int, last: Int, version: Version)
- Type
- PageConnection!
- Description
-
Returns an array of all your pages in a draft or published state paginated by a cursor.
Learn more
-
- Name
pageHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- PageRevisionConnection!
- Description
-
Returns an array of all revisions for the page by ID paginated by a cursor.
Learn more
-
- Name
pageRevision(id: ID!, revisionId: ID!)
- Type
- PageRevision
- Description
-
Returns a page's revision.
Learn more
Mutations
-
- Name
pageCreate(input: PageCreateInput!)
- Type
- Page
- Description
-
Creates a page.
Learn more
-
- Name
pageUpdate(id: ID!, input: PageUpdateInput!)
- Type
- Page
- Description
-
Updates a page.
Learn more
-
- Name
pageDelete(id: ID!)
- Type
- DeletePayload
- Description
-
Deletes a page.
Learn more
-
- Name
pagePublish(id: ID!, publishComment: String)
- Type
- Page
- Description
-
Publishes a page.
Learn more
-
- Name
pageUnpublish(id: ID!)
- Type
- Page
- Description
-
Unpublishes a page.
Learn more
-
- Name
pageRestore(id: ID!, revisionId: ID!)
- Type
- Page
- Description
-
Restores a page to a specific revision.
Learn more
-
- Name
pageDeleteBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk delete pages.
Learn more
-
- Name
pageUpdateBulk(ids: [ID!], input: [PageUpdateInput!]!)
- Type
- Job
- Description
-
Allows you to bulk update pages.
Learn more
-
- Name
pagePublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk publish pages.
Learn more
-
- Name
pageUnpublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk unpublish pages.
Learn more
-
- Name
pageAddSectionsBulk(ids: [ID!]!, input: [PageAddSectionsInput!]!)
- Type
- Job
- Description
-
Assign a section to multiple pages.
Learn more
Product Page
Product pages in Pack are not the actual product pages in Shopify. Pack product pages are separate data that will hold content and can be used in conjunction with your Shopify product.
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
-
- Name
productPage(id: ID!, version: Version)
- Type
- ProductPage!
- Description
-
Returns a product page by ID in a draft or published state.
Learn more
-
- Name
productPageByHandle(handle: String!, version: Version)
- Type
- ProductPage!
- Description
-
Returns a product page by handle in a draft or published state.
Learn more
-
- Name
productPages(after: String, before: String, first: Int, last: Int, version: Version)
- Type
- ProductPageConnection!
- Description
-
Returns an array of all your product pages in a draft or published state paginated by a cursor.
Learn more
-
- Name
productPageHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- ProductPageRevisionConnection!
- Description
-
Returns an array of all revisions for the product page by ID paginated by a cursor.
Learn more
-
- Name
productPageRevision(id: ID!, revisionId: ID!)
- Type
- ProductPageRevision
- Description
-
Returns a product page's revision.
Learn more
Mutations
-
- Name
productPageUpdate(id: ID!, input: ProductPageUpdateInput!)
- Type
- ProductPage
- Description
-
Updates a product page.
Learn more
-
- Name
productPagePublish(id: ID!, publishComment: String)
- Type
- ProductPage
- Description
-
Publishes a product page.
Learn more
-
- Name
productPageUnpublish(id: ID!)
- Type
- ProductPage
- Description
-
Unpublishes a product page.
Learn more
-
- Name
productPageRestore(id: ID!, revisionId: ID!)
- Type
- ProductPage
- Description
-
Restores a product page to a specific revision.
Learn more
-
- Name
productPageUpdateBulk(ids: [ID!], input: [ProductPageUpdateInput!]!)
- Type
- Job
- Description
-
Allows you to bulk update product pages.
Learn more
-
- Name
productPagePublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk publish product pages.
Learn more
-
- Name
productPageUnpublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk unpublish product pages.
Learn more
-
- Name
productPageAddSectionsBulk(ids: [ID!]!, input: [ProductPageAddSectionsInput!]!)
- Type
- Job
- Description
-
Assign a section to multiple product pages.
Learn more
Collection Page
Collection pages in Pack are not the actual collection pages in Shopify. Pack collection pages are separate data that will hold content and can be used in conjunction with your Shopify collection.
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
-
- Name
collectionPage(id: ID!, version: Version)
- Type
- CollectionPage!
- Description
-
Returns a collection page by ID in a draft or published state.
Learn more
-
- Name
collectionPageByHandle(handle: String!, version: Version)
- Type
- CollectionPage!
- Description
-
Returns a collection page by handle in a draft or published state.
Learn more
-
- Name
collectionPages(after: String, before: String, first: Int, last: Int, version: Version)
- Type
- CollectionPageConnection!
- Description
-
Returns an array of all your collection pages in a draft or published state paginated by a cursor.
Learn more
-
- Name
collectionPageHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- CollectionPageRevisionConnection!
- Description
-
Returns an array of all revisions for the collection page by ID paginated by a cursor.
Learn more
-
- Name
collectionPageRevision(id: ID!, revisionId: ID!)
- Type
- CollectionPageRevision
- Description
-
Returns a collection page's revision.
Learn more
Mutations
-
- Name
collectionPageUpdate(id: ID!, input: CollectionPageUpdateInput!)
- Type
- CollectionPage
- Description
-
Updates a collection page.
Learn more
-
- Name
collectionPagePublish(id: ID!, publishComment: String)
- Type
- CollectionPage
- Description
-
Publishes a collection page.
Learn more
-
- Name
collectionPageUnpublish(id: ID!)
- Type
- CollectionPage
- Description
-
Unpublishes a collection page.
Learn more
-
- Name
collectionPageRestore(id: ID!, revisionId: ID!)
- Type
- CollectionPage
- Description
-
Restores a collection page to a specific revision.
Learn more
-
- Name
collectionPageUpdateBulk(ids: [ID!], input: [CollectionPageUpdateInput!]!)
- Type
- Job
- Description
-
Allows you to bulk update collection pages.
Learn more
-
- Name
collectionPagePublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk publish collection pages.
Learn more
-
- Name
collectionPageUnpublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk unpublish collection pages.
Learn more
-
- Name
collectionPageAddSectionsBulk(ids: [ID!]!, input: [CollectionPageAddSectionsInput!]!)
- Type
- Job
- Description
-
Assign a section to multiple collection pages.
Learn more
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
-
- Name
blog(id: ID!, version: Version)
- Type
- Blog
- Description
-
Returns a blog by ID in a draft or published state.
Learn more
-
- Name
blogByHandle(handle: String!, version: Version)
- Type
- Blog
- Description
-
Returns a blog by handle in a draft or published state.
Learn more
-
- Name
blogs(after: String, before: String, first: Int, last: Int, version: Version)
- Type
- BlogConnection!
- Description
-
Returns an array of all your blogs in a draft or published state paginated by a cursor.
Learn more
-
- Name
blogHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- BlogRevisionConnection!
- Description
-
Returns an array of all revisions for the blog by ID paginated by a cursor.
Learn more
-
- Name
blogRevision(id: ID!, revisionId: ID!)
- Type
- BlogRevision
- Description
-
Returns a blog's revision.
Learn more
Mutations
-
- Name
blogCreate(input: BlogCreateInput!)
- Type
- Blog
- Description
-
Creates a blog.
Learn more
-
- Name
blogUpdate(id: ID!, input: BlogUpdateInput!)
- Type
- Blog
- Description
-
Updates a blog.
Learn more
-
- Name
blogDelete(id: ID!)
- Type
- DeletePayload
- Description
-
Deletes a blog.
Learn more
-
- Name
blogPublish(id: ID!, publishComment: String)
- Type
- Blog
- Description
-
Publishes a blog.
Learn more
-
- Name
blogUnpublish(id: ID!)
- Type
- Blog
- Description
-
Unpublishes a blog.
Learn more
-
- Name
blogRestore(id: ID!, revisionId: ID!)
- Type
- Blog
- Description
-
Restores a blog to a specific revision.
Learn more
-
- Name
blogDeleteBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk delete blogs.
Learn more
-
- Name
blogUpdateBulk(ids: [ID!], input: [BlogUpdateInput!]!)
- Type
- Job
- Description
-
Allows you to bulk update blogs.
Learn more
-
- Name
blogPublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk publish blogs.
Learn more
-
- Name
blogUnpublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk unpublish blogs.
Learn more
-
- Name
blogAddSectionsBulk(ids: [ID!]!, input: [BlogAddSectionsInput!]!)
- Type
- Job
- Description
-
Assign a section to multiple blogs.
Learn more
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
-
- Name
article(id: ID!, version: Version)
- Type
- Article
- Description
-
Returns an article by ID in a draft or published state.
Learn more
-
- Name
articleByHandle(handle: String!, version: Version)
- Type
- Article
- Description
-
Returns an article by hande in a draft or published state.
Learn more
-
- Name
articles(after: String, before: String, first: Int, last: Int, version: Version)
- Type
- ArticleConnection!
- Description
-
Returns an array of all your articles in a draft or published state paginated by a cursor.
Learn more
-
- Name
articleHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- ArticleRevisionConnection!
- Description
-
Returns an array of all revisions for the article by ID paginated by a cursor.
Learn more
-
- Name
articleRevision(id: ID!, revisionId: ID!)
- Type
- ArticleRevision
- Description
-
Returns an article's revision.
Learn more
Mutations
-
- Name
articleCreate(input: ArticleCreateInput!)
- Type
- Article
- Description
-
Creates an article.
Learn more
-
- Name
articleUpdate(id: ID!, input: ArticleUpdateInput!)
- Type
- Article
- Description
-
Updates an article.
Learn more
-
- Name
articleDelete(id: ID!)
- Type
- DeletePayload
- Description
-
Deletes an article.
Learn more
-
- Name
articlePublish(id: ID!, publishComment: String)
- Type
- Article
- Description
-
Publishes an article.
Learn more
-
- Name
articleUnpublish(id: ID!)
- Type
- Article
- Description
-
Unpublishes an article.
Learn more
-
- Name
articleRestore(id: ID!, revisionId: ID!)
- Type
- Article
- Description
-
Restores an article to a specific revision.
Learn more
-
- Name
articleDeleteBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk delete articles.
Learn more
-
- Name
articleUpdateBulk(ids: [ID!], input: [ArticleUpdateInput!]!)
- Type
- Job
- Description
-
Bulk update articles.
Learn more
-
- Name
articlePublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk publish articles.
Learn more
-
- Name
articleUnpublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk unpublish articles.
Learn more
-
- Name
articleAddSectionsBulk(ids: [ID!]!, input: [ArticleAddSectionsInput!]!)
- Type
- Job
- Description
-
Assign a section to multiple articles.
Learn more
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
-
- Name
section(id: ID!, version: Version)
- Type
- Section
- Description
-
Returns a section by ID in a draft or published state.
Learn more
-
- Name
sections(after: String, before: String, first: Int, last: Int, version: Version)
- Type
- SectionConnection!
- Description
-
Returns an array of all your sections in a draft or published state paginated by a cursor.
Learn more
-
- Name
sectionHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- SectionRevisionConnection!
- Description
-
Returns an array of all revisions for the section by ID paginated by a cursor.
Learn more
-
- Name
sectionRevision(id: ID!, revisionId: ID!)
- Type
- SectionRevision
- Description
-
Returns a section's revision.
Learn more
-
- Name
sectionReferences(id: ID!, revisionId: ID!)
- Type
- [Reference!]!
- Description
-
Returns a list of references where the section is used.
Learn more
Mutations
-
- Name
sectionUpsert(input: SectionUpsertInput!)
- Type
- Section
- Description
-
Creates or updates a section.
Learn more
-
- Name
sectionDelete(id: ID!)
- Type
- DeletePayload
- Description
-
Deletes a section.
Learn more
-
- Name
sectionPublish(id: ID!)
- Type
- Section
- Description
-
Publishes a section.
Learn more
-
- Name
sectionUnpublish(id: ID!)
- Type
- Section
- Description
-
Unpublishes a section.
Learn more
-
- Name
sectionRestore(id: ID!, revisionId: ID!)
- Type
- Section
- Description
-
Restores a section to a specific revision.
Learn more
-
- Name
sectionDeleteBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk delete sections.
Learn more
-
- Name
sectionPublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk publish sections.
Learn more
-
- Name
sectionUnpublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk unpublish sections.
Learn more
Site Settings
This is the storefront site settings.
Queries
-
- Name
siteSettings(version: Version)
- Type
- SiteSettings!
- Description
-
Returns the site settings in a draft or published state.
Learn more
-
- Name
siteSettingsHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- SiteSettingsRevisionConnection!
- Description
-
Returns an array of all revisions for the site settings by ID paginated by a cursor.
Learn more
-
- Name
siteSettingsRevision(id: ID!, revisionId: ID!)
- Type
- SiteSettingsRevision
- Description
-
Returns a site settings' revision.
Learn more
-
- Name
faviconUploadUrl(id: String!)
- Type
- String!
- Description
-
Returns the favicon upload URL.
Learn more
Mutations
-
- Name
siteSettingsUpdate(input: SiteSettingsUpdateInput!)
- Type
- SiteSettings!
- Description
-
Updates the site settings.
Learn more
-
- Name
siteSettingsPublish(id: ID!, publishComment: String)
- Type
- SiteSettings!
- Description
-
Publishes the site settings.
Learn more
-
- Name
siteSettingsRestore(revisionId: String!)
- Type
- SiteSettings!
- Description
-
Restores the site settings to a specific revision.
Learn more
Schedules
Schedules are used to publish or unpublish content at a specific time in the future.
Queries
-
- Name
schedule(id: ID!)
- Type
- Schedule
- Description
-
Returns a schedule by ID.
Learn more
-
- Name
schedules(after: String, before: String, first: Int, last: Int)
- Type
- ScheduleConnection!
- Description
-
Returns a list of schedules paginated by a cursor.
Learn more
-
- Name
schedulesByContentId(contentId: ID!, after: String, before: String, first: Int, last: Int)
- Type
- ScheduleConnection!
- Description
-
Returns a list of schedules that contain a content ID paginated by a cursor.
Learn more
Mutations
-
- Name
scheduleCreate(input: CreateScheduleInput!)
- Type
- Schedule!
- Description
-
Creates a schedule.
Learn more
-
- Name
scheduleUpdate(input: UpdateScheduleInput!)
- Type
- Schedule!
- Description
-
Updates a schedule.
Learn more
-
- Name
scheduleAddContent(id: ID!, input: AddContentToScheduleInput!)
- Type
- Schedule!
- Description
-
Adds content to a schedule by ID.
Learn more
-
- Name
scheduleDelete(id: ID!)
- Type
- DeletePayload
- Description
-
Deletes a schedule.
Learn more
-
- Name
schedulePublish(id: ID!)
- Type
- Schedule!
- Description
-
Publishes a schedule.
Learn more
Templates
A template is a container for template sections and is used to repeat these sections throughout pages that use the template.
Queries
-
- Name
template(id: ID!, version: Version)
- Type
- Template
- Description
-
Returns a template by ID in a draft or published state.
Learn more
-
- Name
templates(after: String, before: String, first: Int, last: Int, version: Version)
- Type
- TemplateConnection!
- Description
-
Returns an array of all your templates in a draft or published state paginated by a cursor.
Learn more
-
- Name
templateHistory(id: ID!, after: String, before: String, first: Int, last: Int)
- Type
- TemplateVersionConnection!
- Description
-
Returns an array of all revisions for the template by ID paginated by a cursor.
Learn more
-
- Name
templateReferences(id: ID!)
- Type
- [Reference]
- Description
-
Returns a list of references where the template is used.
Learn more
Mutations
-
- Name
templateCreate(input: TemplateCreatetInput!)
- Type
- Template!
- Description
-
Creates a template.
Learn more
-
- Name
templateUpdate(id: ID!, input: TemplateUpdateInput!)
- Type
- Template
- Description
-
Updates a template.
Learn more
-
- Name
templateDelete(id: ID!)
- Type
- DeletePayload!
- Description
-
Deletes a template.
Learn more
-
- Name
templatePublish(id: ID!)
- Type
- Template
- Description
-
Publishes a template.
Learn more
-
- Name
templatePublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk publishes templates.
Learn more
-
- Name
templateUnpublish(id: ID!)
- Type
- Template
- Description
-
Unpublishes a template.
Learn more
-
- Name
templateUnpublishBulk(ids: [ID!]!)
- Type
- Job
- Description
-
Bulk unpublishes templates.
Learn more
-
- Name
templateAddSectionsBulk(ids: [ID!]!, input: [TemplateAddSectionsInput!]!)
- Type
- Job
- Description
-
Assigns sections to multiple templates.
Learn more