Page

In addition to an online storefront, Shopify stores come with a tool for creating basic HTML web pages. Store owners can create any number of pages to hold static content, such as an About us page, a Contact us page, or a page with customer testimonials.

These web pages are represented by the Page resource, and their HTML content is contained in the value of the body_html property. The Page resource lets you retrieve, create, update, and delete web pages for a store.

Pages are meant to be used for long-term, static content that rarely changes. For creating content on a regular basis, use the Blog resource instead.

What you can do with Page

The Shopify API lets you do the following with the Page resource. More detailed versions of these general actions may be available:

Page properties

author
"author": "Lydia"

The name of the person who created the page.

body_html
"body_html": "Contact us at <a href=\"mailto:contact@johns-apparel.com\">contact@johns-apparel.com</a>."

The text content of the page, complete with HTML markup.

created_at
"created_at": "2008-07-15T20:00:00-04:00"

The date and time (ISO 8601 format) when the page was created.

handle
"handle": "contact-us"

A unique, human-friendly string for the page, generated automatically from its title. In online store themes, the Liquid templating language refers to a page by its handle.

id
"id": 131092082

The unique numeric identifier for the page.

metafield
"metafield": {
  "key": "new",
  "value": "new value",
  "value_type": "string",
  "namespace": "global"
}

Additional information attached to the Page object. It has the following properties:

  • key: An identifier for the metafield. (maximum: 30 characters)
  • namespace: A container for a set of metadata. Namespaces help distinguish between metadata created by different apps. (maximum: 20 characters)
  • value: The information to be stored as metadata.
  • value_type: The information type that's being stored. Valid values: string or integer.
  • description (optional): Additional information about the metafield.

For more information on attaching metadata to Shopify resources, see the Metafield resource.

published_at
"published_at": "2014-07-16T20:00:00-04:00"

The date and time (ISO 8601 format) when the page was published. Returns null when the page is hidden.

shop_id
"shop_id": 690933842

The ID of the shop to which the page belongs.

template_suffix
"template_suffix": "contact"

The suffix of the Liquid template being used. For example, if the value is contact, then the page is using the page.contact.liquid template. If the value is an empty string, then the page is using the default page.liquid template.

title
"title": "Contact us"

The page's title.

updated_at
"updated_at": "2008-07-16T20:00:00-04:00"

The date and time (ISO 8601 format) when the page was last updated.

Endpoints

GET /admin/pages.json
Retrieve a list of all pages
limit

The maximum number of results to show.

(default: 50) (maximum: 250)
page

The page of results to show.

(default: 1)
since_id

Restrict results to after the specified ID.

title

Retrieve pages with a given title.

handle

Retrieve a page with a given handle.

created_at_min

Show pages created after date (format: 2008-12-31).

created_at_max

Show pages created before date (format: 2008-12-31).

updated_at_min

Show pages last updated after date (format: 2008-12-31).

updated_at_max

Show pages last updated before date (format: 2008-12-31).

published_at_min

Show pages published after date (format: 2014-04-25T16:15:47-04:00).

published_at_max

Show pages published before date (format: 2014-04-25T16:15:47-04:00).

fields

Show only certain fields, specified by a comma-separated list of field names.

published_status

Restrict results to pages with a given published status:

(default: any)
  • published: Show only published pages.
  • unpublished: Show only unpublished pages.
  • any: Show published and unpublished pages.

Get all pages for a shop

GET /admin/pages.json
View Response
HTTP/1.1 200 OK
{
  "pages": [
    {
      "id": 108828309,
      "title": "Sample Page",
      "shop_id": 690933842,
      "handle": "sample",
      "body_html": "<p>this is a <strong>sample</strong> page.</p>",
      "author": "Dennis",
      "created_at": "2008-07-15T20:00:00-04:00",
      "updated_at": "2008-07-16T20:00:00-04:00",
      "published_at": null,
      "template_suffix": null
    },
    {
      "id": 169524623,
      "title": "Store hours",
      "shop_id": 690933842,
      "handle": "store-hours",
      "body_html": "<p>We never close.</p>",
      "author": "Jobs",
      "created_at": "2013-12-31T19:00:00-05:00",
      "updated_at": "2013-12-31T19:00:00-05:00",
      "published_at": "2014-02-01T19:00:00-05:00",
      "template_suffix": null
    },
    {
      "id": 322471,
      "title": "Support",
      "shop_id": 690933842,
      "handle": "support",
      "body_html": "<p>Come in store for support.</p>",
      "author": "Dennis",
      "created_at": "2009-07-15T20:00:00-04:00",
      "updated_at": "2009-07-16T20:00:00-04:00",
      "published_at": null,
      "template_suffix": null
    },
    {
      "id": 131092082,
      "title": "Terms of Services",
      "shop_id": 690933842,
      "handle": "tos",
      "body_html": "<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>",
      "author": "Dennis",
      "created_at": "2008-07-15T20:00:00-04:00",
      "updated_at": "2008-07-16T20:00:00-04:00",
      "published_at": "2008-07-15T20:00:00-04:00",
      "template_suffix": null
    }
  ]
}

Retrieve a list of all pages after the specified ID

GET /admin/pages.json?since_id=108828309
View Response
HTTP/1.1 200 OK
{
  "pages": [
    {
      "id": 131092082,
      "title": "Terms of Services",
      "shop_id": 690933842,
      "handle": "tos",
      "body_html": "<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>",
      "author": "Dennis",
      "created_at": "2008-07-15T20:00:00-04:00",
      "updated_at": "2008-07-16T20:00:00-04:00",
      "published_at": "2008-07-15T20:00:00-04:00",
      "template_suffix": null
    },
    {
      "id": 169524623,
      "title": "Store hours",
      "shop_id": 690933842,
      "handle": "store-hours",
      "body_html": "<p>We never close.</p>",
      "author": "Jobs",
      "created_at": "2013-12-31T19:00:00-05:00",
      "updated_at": "2013-12-31T19:00:00-05:00",
      "published_at": "2014-02-01T19:00:00-05:00",
      "template_suffix": null
    }
  ]
}
GET /admin/pages/count.json
Retrieves a page count.
title

Count pages with a given title.

created_at_min

Count pages created after date (format: 2008-12-31).

created_at_max

Count pages created before date (format: 2008-12-31).

updated_at_min

Count pages last updated after date (format: 2008-12-31).

updated_at_max

Count pages last updated before date (format: 2008-12-31).

published_at_min

Show pages published after date (format: 2014-04-25T16:15:47-04:00).

published_at_max

Show pages published before date (format: 2014-04-25T16:15:47-04:00).

published_status

Count pages with a given published status:

(default: any)
  • published: Count published pages.
  • unpublished: Count unpublished pages.
  • any: Count published and unpublished pages.

Retrieve a count of all pages

GET /admin/pages/count.json
View Response
HTTP/1.1 200 OK
{
  "count": 4
}
GET /admin/pages/131092082.json
Retrieves a single page by its ID.
fields

Show only certain fields, specified by a comma-separated list of field names.

Retrieve a single page

GET /admin/pages/#{page_id}.json
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "Terms of Services",
    "shop_id": 690933842,
    "handle": "tos",
    "body_html": "<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>",
    "author": "Dennis",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2008-07-16T20:00:00-04:00",
    "published_at": "2008-07-15T20:00:00-04:00",
    "template_suffix": null
  }
}
POST /admin/pages.json
Creates a page.

Create a page with HTML markup

POST /admin/pages.json
{
  "page": {
    "title": "Warranty information",
    "body_html": "<h2>Warranty</h2>\n<p>Returns accepted if we receive items <strong>30 days after purchase</strong>.</p>"
  }
}
View Response
HTTP/1.1 201 Created
{
  "page": {
    "id": 905192166,
    "title": "Warranty information",
    "shop_id": 690933842,
    "handle": "warranty-information",
    "body_html": "<h2>Warranty</h2>\n<p>Returns accepted if we receive items <strong>30 days after purchase</strong>.</p>",
    "author": "Shopify API",
    "created_at": "2018-05-07T15:47:32-04:00",
    "updated_at": "2018-05-07T15:47:32-04:00",
    "published_at": "2018-05-07T15:47:32-04:00",
    "template_suffix": null
  }
}

Create an unpublished page

POST /admin/pages.json
{
  "page": {
    "title": "Warranty information",
    "body_html": "<h2>Warranty</h2>\n<p>Returns accepted if we receive items <strong>30 days after purchase</strong>.</p>",
    "published": false
  }
}
View Response
HTTP/1.1 201 Created
{
  "page": {
    "id": 905192167,
    "title": "Warranty information",
    "shop_id": 690933842,
    "handle": "warranty-information",
    "body_html": "<h2>Warranty</h2>\n<p>Returns accepted if we receive items <strong>30 days after purchase</strong>.</p>",
    "author": "Shopify API",
    "created_at": "2018-05-07T15:47:32-04:00",
    "updated_at": "2018-05-07T15:47:32-04:00",
    "published_at": null,
    "template_suffix": null
  }
}

Creating a page without a title fails and returns an error

POST /admin/pages.json
{
  "page": {
    "body": "foobar"
  }
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
  "errors": {
    "title": [
      "can't be blank"
    ]
  }
}

Create a page with a metafield

POST /admin/pages.json
{
  "page": {
    "title": "Warranty information",
    "body_html": "<h2>Warranty</h2>\n<p>Returns accepted if we receive items <strong>30 days after purchase</strong>.</p>",
    "metafields": [
      {
        "key": "new",
        "value": "new value",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}
View Response
HTTP/1.1 201 Created
{
  "page": {
    "id": 905192168,
    "title": "Warranty information",
    "shop_id": 690933842,
    "handle": "warranty-information",
    "body_html": "<h2>Warranty</h2>\n<p>Returns accepted if we receive items <strong>30 days after purchase</strong>.</p>",
    "author": "Shopify API",
    "created_at": "2018-05-07T15:47:32-04:00",
    "updated_at": "2018-05-07T15:47:33-04:00",
    "published_at": "2018-05-07T15:47:32-04:00",
    "template_suffix": null
  }
}
PUT /admin/pages/131092082.json
Updates a page.

Update the body HTML of an existing page

PUT /admin/pages/#{page_id}.json
{
  "page": {
    "id": 131092082,
    "body_html": "<p>Returns accepted if we receive the items 14 days after purchase.</p>"
  }
}
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "Terms of Services",
    "shop_id": 690933842,
    "handle": "tos",
    "body_html": "<p>Returns accepted if we receive the items 14 days after purchase.</p>",
    "author": "Dennis",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2018-05-07T15:47:33-04:00",
    "published_at": "2008-07-15T20:00:00-04:00",
    "template_suffix": null
  }
}

Update an existing page completely

PUT /admin/pages/#{page_id}.json
{
  "page": {
    "id": 131092082,
    "body_html": "<p>Returns accepted if we receive the items <strong>14 days</strong> after purchase.</p>",
    "author": "Christopher Gorski",
    "title": "New warranty",
    "handle": "new-warranty"
  }
}
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "New warranty",
    "shop_id": 690933842,
    "handle": "new-warranty",
    "body_html": "<p>Returns accepted if we receive the items <strong>14 days</strong> after purchase.</p>",
    "author": "Christopher Gorski",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2018-05-07T15:47:33-04:00",
    "published_at": "2008-07-15T20:00:00-04:00",
    "template_suffix": null
  }
}

Show a hidden page

PUT /admin/pages/#{page_id}.json
{
  "page": {
    "id": 131092082,
    "published": true
  }
}
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "Terms of Services",
    "shop_id": 690933842,
    "handle": "tos",
    "body_html": "<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>",
    "author": "Dennis",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2018-05-07T15:47:33-04:00",
    "published_at": "2018-05-07T15:47:33-04:00",
    "template_suffix": null
  }
}

Hide a published page

PUT /admin/pages/#{page_id}.json
{
  "page": {
    "id": 131092082,
    "published": false
  }
}
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "Terms of Services",
    "shop_id": 690933842,
    "handle": "tos",
    "body_html": "<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>",
    "author": "Dennis",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2018-05-07T15:47:34-04:00",
    "published_at": null,
    "template_suffix": null
  }
}

Add a metafield to a page

PUT /admin/pages/#{page_id}.json
{
  "page": {
    "id": 131092082,
    "metafields": [
      {
        "key": "new",
        "value": "new value",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "Terms of Services",
    "shop_id": 690933842,
    "handle": "tos",
    "body_html": "<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>",
    "author": "Dennis",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2018-05-07T15:47:34-04:00",
    "published_at": "2008-07-15T20:00:00-04:00",
    "template_suffix": null
  }
}
DELETE /admin/pages/131092082.json
Deletes a page.

Delete a page

DELETE /admin/pages/#{page_id}.json
View Response
HTTP/1.1 200 OK
{
}