Page

In addition to an online storefront, Shopify shops come with a web page creation tool, allowing a shop to have one or more pages. Shop owners are encouraged to use pages for information that customers will use often, such as an 'About Us' page, a 'Contact Us' page, a page with customer testimonials etc.

Reminder

Pages are meant to be used for static content. If the shop needs a page for content that is created on a regular basis, we recommend that you use the blog feature instead.

What can you 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" : "We don't need a warranty" }

Text content of the page, complete with HTML markup.

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

The date and time when the page was created. The API returns this value in ISO 8601 format.

handle
{ "handle" : "tos" }

A human-friendly unique string for the page automatically generated from its title. This is used in shop themes by the Liquid templating language to refer to the page.

id
{ "id" : 131092082 }

The unique numeric identifier for the page.

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

Attaches additional information to a shop's resources:

  • key (required): Identifier for the metafield (maximum of 30 characters).
  • namespace (required): Container for a set of metadata. Namespaces help distinguish between metadata you created and metadata created by another individual with a similar namespace (maximum of 20 characters).
  • value (required): Information to be stored as metadata.
  • value_type (required): States whether the information in the value is stored as a 'string' or 'integer.'
  • description (optional): Additional information about the metafield.

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

This can have two different types of values, depending on whether the page has been published (i.e., made visible to the blog's readers).

  • If the page is published, this value is the date and time when it was published. The API returns this value in ISO 8601 format.
  • If the page is a hidden, this value is null. Changing an page's status from published to hidden changes its published_at property to null.

shop_id
{ "shop_id" : 690933842 }

The id of the shop to which the page belongs.

template_suffix
{ "template_suffix" : null }

The suffix of the liquid template being used. By default, the original template is called page.liquid, without any suffix. Any additional templates will be: page.suffix.liquid.

title
{ "title" : "Terms of Services" }

The title of the page.

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

The date and time when the page was last updated. The API returns this value in ISO 8601 format.

Endpoints

GET/admin/pages.json

Get a list of all pages

limit

Amount of results

(default: 50) (maximum: 250)
page

Page to show

(default: 1)
since_id

Restrict results to after the specified ID

title

Show pages by Title

handle

Filter by Page 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

comma-separated list of fields to include in the response

published_status
  • published - Show only published pages
  • unpublished - Show only unpublished pages
  • any - Show all pages (default)

Get 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 all pages for a shop

GET /admin/pages.json
View Response
HTTP/1.1 200 OK
{
  "pages": [
    {
      "id": 322471,
      "title": "Support",
      "shop_id": 690933842,
      "handle": "support",
      "body_html": "<p>Come instore 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": 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": 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

Get a count of all pages

title

Pages with a given title

created_at_min

Pages created after date (format: 2008-12-31)

created_at_max

Pages created before date (format: 2008-12-31)

updated_at_min

Pages last updated after date (format: 2008-12-31)

updated_at_max

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
  • published - Only published pages
  • unpublished - Only unpublished pages
  • any - All pages (default)

Count all pages for a shop

GET /admin/pages/count.json
View Response
HTTP/1.1 200 OK
{
  "count": 4
}
GET/admin/pages/131092082.json

Get a single page by its ID

fields

comma-separated list of fields to include in the response

Get a single page

GET /admin/pages/#{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

Create a new page

Create a page with a metafield

POST /admin/pages.json
{
  "page": {
    "title": "Warranty information",
    "body_html": "<h1>Warranty<\/h1>\n<p><strong>Forget it<\/strong>, we aint giving you nothing<\/p>",
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}
View Response
HTTP/1.1 201 Created
{
  "page": {
    "id": 905192166,
    "title": "Warranty information",
    "shop_id": 690933842,
    "handle": "warranty-information",
    "body_html": "<h1>Warranty<\/h1>\n<p><strong>Forget it<\/strong>, we aint giving you nothing<\/p>",
    "author": "Shopify API",
    "created_at": "2016-06-20T13:38:11-04:00",
    "updated_at": "2016-06-20T13:38:11-04:00",
    "published_at": "2016-06-20T13:38:11-04:00",
    "template_suffix": null
  }
}

Create a new page with html markup and upload it to the shop

POST /admin/pages.json
{
  "page": {
    "title": "Warranty information",
    "body_html": "<h1>Warranty<\/h1>\n<p><strong>Forget it<\/strong>, we aint giving you nothing<\/p>"
  }
}
View Response
HTTP/1.1 201 Created
{
  "page": {
    "id": 905192167,
    "title": "Warranty information",
    "shop_id": 690933842,
    "handle": "warranty-information",
    "body_html": "<h1>Warranty<\/h1>\n<p><strong>Forget it<\/strong>, we aint giving you nothing<\/p>",
    "author": "Shopify API",
    "created_at": "2016-06-20T13:38:14-04:00",
    "updated_at": "2016-06-20T13:38:14-04:00",
    "published_at": "2016-06-20T13:38:14-04:00",
    "template_suffix": null
  }
}

Create a new, but unpublished page

POST /admin/pages.json
{
  "page": {
    "title": "Warranty information",
    "body_html": "<h1>Warranty<\/h1>\n<p><strong>Forget it<\/strong>, we aint giving you nothing<\/p>",
    "published": false
  }
}
View Response
HTTP/1.1 201 Created
{
  "page": {
    "id": 905192169,
    "title": "Warranty information",
    "shop_id": 690933842,
    "handle": "warranty-information",
    "body_html": "<h1>Warranty<\/h1>\n<p><strong>Forget it<\/strong>, we aint giving you nothing<\/p>",
    "author": "Shopify API",
    "created_at": "2016-06-20T13:38:16-04:00",
    "updated_at": "2016-06-20T13:38:16-04:00",
    "published_at": null,
    "template_suffix": null
  }
}

Trying to create a page without a title will return an error

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

Update a page

Hide a published page by changing the published attribute to false

PUT /admin/pages/#{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": "2016-06-20T13:38:11-04:00",
    "published_at": null,
    "template_suffix": null
  }
}

Add a metafield to an existing page

PUT /admin/pages/#{id}.json
{
  "page": {
    "id": 131092082,
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "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": "2016-06-20T13:38:12-04:00",
    "published_at": "2008-07-15T20:00:00-04:00",
    "template_suffix": null
  }
}

Update an existing page completely

PUT /admin/pages/#{id}.json
{
  "page": {
    "id": 131092082,
    "body_html": "<p>Okay, maybe we will give you a warranty.<\/p>",
    "author": "Your name",
    "title": "My new Title",
    "handle": "new-title"
  }
}
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "My new Title",
    "shop_id": 690933842,
    "handle": "new-title",
    "body_html": "<p>Okay, maybe we will give you a warranty.<\/p>",
    "author": "Your name",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2016-06-20T13:38:13-04:00",
    "published_at": "2008-07-15T20:00:00-04:00",
    "template_suffix": null
  }
}

Update an existing page body_html

PUT /admin/pages/#{id}.json
{
  "page": {
    "id": 131092082,
    "body_html": "<p>Okay, maybe we will give you a warranty.<\/p>"
  }
}
View Response
HTTP/1.1 200 OK
{
  "page": {
    "id": 131092082,
    "title": "Terms of Services",
    "shop_id": 690933842,
    "handle": "tos",
    "body_html": "<p>Okay, maybe we will give you a warranty.<\/p>",
    "author": "Dennis",
    "created_at": "2008-07-15T20:00:00-04:00",
    "updated_at": "2016-06-20T13:38:14-04:00",
    "published_at": "2008-07-15T20:00:00-04:00",
    "template_suffix": null
  }
}

Show a hidden page by changing the published attribute to true

PUT /admin/pages/#{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": "2016-06-20T13:38:15-04:00",
    "published_at": "2016-06-20T13:38:15-04:00",
    "template_suffix": null
  }
}
DELETE/admin/pages/131092082.json

Delete a page

Remove an existing page from a shop

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