# Page <p>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 <strong>About us</strong> page, a <strong>Contact us</strong> page, or a page with customer testimonials.</p> <p>These web pages are represented by the Page resource, and their HTML content is contained in the value of the <code>body_html</code> property. The Page resource lets you retrieve, create, update, and delete web pages for a store.</p> <p>Pages are meant to be used for long-term, static content that rarely changes. For creating content on a regular basis, use the <a href="/docs/admin-api/rest/reference/online-store/blog">Blog</a> resource instead.</p> ## Resource Properties ### Page * author: The name of the person who created the page. * Type: x-string * Example: "Lydia" * body_html: The text content of the page, complete with HTML markup. * Type: x-string * Example: "Contact us at <a href='mailto:contact@example.com'>contact@example.com</a>." * created_at: The date and time (<a href='https://en.wikipedia.org/wiki/ISO_8601' target="_blank">ISO 8601</a> format) when the page was created. * Type: x-string * Example: "2008-07-15T20:00:00-04:00" * handle: A unique, human-friendly string for the page, generated automatically from its title. In themes, the Liquid templating language refers to a page by its handle. * Type: x-string * Example: "contact-us" * id: The unique numeric identifier for the page. * Type: x-string * Example: 131092082 * metafield: Additional information attached to the Page object. It has the following properties: <ul> <li><strong>key</strong>: An identifier for the metafield. (maximum: 30 characters)</li> <li><strong>namespace</strong>: A container for a set of metadata. Namespaces help distinguish between metadata created by different apps. (maximum: 20 characters)</li> <li><strong>value</strong>: The information to be stored as metadata.</li> <li><strong>type</strong>: The metafield's information type. Refer to the <a href="/apps/metafields/types">full list of types</a>.</li> <li><strong>description (optional)</strong>: Additional information about the metafield.</li> </ul> <p>For more information on attaching metadata to Shopify resources, see the <a href="/docs/admin-api/rest/reference/metafield">Metafield</a> resource.</p> * Type: x-string * Example: {"key"=>"new", "value"=>"new value", "type"=>"single_line_text_field", "namespace"=>"global"} * published_at: The date and time (<a href='https://en.wikipedia.org/wiki/ISO_8601' target='_blank'>ISO 8601</a> format) when the page was published. Returns <code>null</code> when the page is hidden. * Type: x-string * Example: "2014-07-16T20:00:00-04:00" * shop_id: The ID of the shop to which the page belongs. * Type: x-string * Example: 548380009 * template_suffix: The suffix of the <a href='/api/liquid/objects/template'>template</a> that is used to render the page. If the value is an empty string or <code>null</code>, then the default page template is used. * Type: x-string * Example: "contact" * title: The title of the page. * Type: x-string * Example: "Contact us" * updated_at: The date and time (<a href='https://en.wikipedia.org/wiki/ISO_8601' target="_blank">ISO 8601</a> format) when the page was last updated. * Type: x-string * Example: "2008-07-16T20:00:00-04:00" * admin_graphql_api_id: The GraphQL GID of the page. * Type: x-string * Example: "gid://shopify/OnlineStorePage/131092082" ## Retrieves a list of pages Retrieve a list of all pages. <strong>Note:</strong> This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to <a href='/api/usage/pagination-rest'>Make paginated requests to the REST Admin API</a>. ### Endpoint /admin/api/#{api_version}/pages.json (GET) ### Parameters * api_version (required): * created_at_max: Show pages created before date (format: 2014-04-25T16:15:47-04:00). * created_at_min: Show pages created after date (format: 2014-04-25T16:15:47-04:00). * fields: Show only certain fields, specified by a comma-separated list of field names. * handle: Retrieve a page with a given handle. * limit: The maximum number of results to show. * published_at_max: Show pages published before date (format: 2014-04-25T16:15:47-04:00). * published_at_min: Show pages published after date (format: 2014-04-25T16:15:47-04:00). * published_status: Restrict results to pages with a given published status: * since_id: Restrict results to after the specified ID. * title: Retrieve pages with a given title. * updated_at_max: Show pages last updated before date (format: 2014-04-25T16:15:47-04:00). * updated_at_min: Show pages last updated after date (format: 2014-04-25T16:15:47-04:00). ### Responses #### 200 Retrieves a list of pages Examples: ##### Get all pages for a shop Request: ``` GET /admin/api/unstable/pages.json ``` Response: ``` HTTP/1.1 200 OK {"pages":[{"id":108828309,"title":"Sample Page","shop_id":548380009,"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,"admin_graphql_api_id":"gid://shopify/Page/108828309"},{"id":169524623,"title":"Store hours","shop_id":548380009,"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,"admin_graphql_api_id":"gid://shopify/Page/169524623"},{"id":322471,"title":"Support","shop_id":548380009,"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,"admin_graphql_api_id":"gid://shopify/Page/322471"},{"id":131092082,"title":"Terms of Services","shop_id":548380009,"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,"admin_graphql_api_id":"gid://shopify/Page/131092082"}]} ``` ##### Retrieve a list of all pages after the specified ID Request: ``` GET /admin/api/unstable/pages.json ``` Response: ``` HTTP/1.1 200 OK {"pages":[{"id":131092082,"title":"Terms of Services","shop_id":548380009,"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,"admin_graphql_api_id":"gid://shopify/Page/131092082"},{"id":169524623,"title":"Store hours","shop_id":548380009,"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,"admin_graphql_api_id":"gid://shopify/Page/169524623"}]} ``` ## Creates a page Creates a page ### Endpoint /admin/api/#{api_version}/pages.json (POST) ### Parameters * api_version (required): ### Responses #### 201 Creates a page Examples: ##### Create a page with HTML markup Request: ``` POST /admin/api/unstable/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>"}} ``` Response: ``` HTTP/1.1 201 Created {"page":{"id":1025371368,"title":"Warranty information","shop_id":548380009,"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":"2025-01-02T11:35:08-05:00","updated_at":"2025-01-02T11:35:08-05:00","published_at":"2025-01-02T11:35:08-05:00","template_suffix":null,"admin_graphql_api_id":"gid://shopify/Page/1025371368"}} ``` ##### Create a page with a metafield Request: ``` POST /admin/api/unstable/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","type":"single_line_text_field","namespace":"global"}]}} ``` Response: ``` HTTP/1.1 201 Created {"page":{"id":1025371371,"title":"Warranty information","shop_id":548380009,"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":"2025-01-02T11:35:18-05:00","updated_at":"2025-01-02T11:35:18-05:00","published_at":"2025-01-02T11:35:18-05:00","template_suffix":null,"admin_graphql_api_id":"gid://shopify/Page/1025371371"}} ``` ##### Create an unpublished page Request: ``` POST /admin/api/unstable/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}} ``` Response: ``` HTTP/1.1 201 Created {"page":{"id":1025371369,"title":"Warranty information","shop_id":548380009,"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":"2025-01-02T11:35:15-05:00","updated_at":"2025-01-02T11:35:15-05:00","published_at":null,"template_suffix":null,"admin_graphql_api_id":"gid://shopify/Page/1025371369"}} ``` #### 422 Creates a page Examples: ##### Creating a page without a title fails and returns an error Request: ``` POST /admin/api/unstable/pages.json {"page":{"body":"foobar"}} ``` Response: ``` HTTP/1.1 422 Unprocessable Entity {"errors":{"title":["can't be blank"]}} ``` ## Retrieves a page count Retrieves a page count. ### Endpoint /admin/api/#{api_version}/pages/count.json (GET) ### Parameters * api_version (required): * created_at_max: Count pages created before date (format: 2014-04-25T16:15:47-04:00). * created_at_min: Count pages created 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_at_min: Show pages published after date (format: 2014-04-25T16:15:47-04:00). * published_status: Count pages with a given published status: * title: Count pages with a given title. * updated_at_max: Count pages last updated before date (format: 2014-04-25T16:15:47-04:00). * updated_at_min: Count pages last updated after date (format: 2014-04-25T16:15:47-04:00). ### Responses #### 200 Retrieves a page count Examples: ##### Retrieve a count of all pages Request: ``` GET /admin/api/unstable/pages/count.json ``` Response: ``` HTTP/1.1 200 OK {"count":4} ``` ## Retrieves a single page by its ID Retrieves a single page by its ID. ### Endpoint /admin/api/#{api_version}/pages/{page_id}.json (GET) ### Parameters * api_version (required): * page_id (required): * fields: Show only certain fields, specified by a comma-separated list of field names. ### Responses #### 200 Retrieves a single page by its ID Examples: ##### Retrieve a single page Request: ``` GET /admin/api/unstable/pages/131092082.json ``` Response: ``` HTTP/1.1 200 OK {"page":{"id":131092082,"title":"Terms of Services","shop_id":548380009,"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,"admin_graphql_api_id":"gid://shopify/Page/131092082"}} ``` ## Updates a page Updates a page ### Endpoint /admin/api/#{api_version}/pages/{page_id}.json (PUT) ### Parameters * api_version (required): * page_id (required): ### Responses #### 200 Updates a page Examples: ##### Add a metafield to a page Request: ``` PUT /admin/api/unstable/pages/131092082.json {"page":{"id":131092082,"metafields":[{"key":"new","value":"new value","type":"single_line_text_field","namespace":"global"}]}} ``` Response: ``` HTTP/1.1 200 OK {"page":{"shop_id":548380009,"title":"Terms of Services","handle":"tos","body_html":"<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>","id":131092082,"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,"admin_graphql_api_id":"gid://shopify/Page/131092082"}} ``` ##### Hide a published page Request: ``` PUT /admin/api/unstable/pages/131092082.json {"page":{"id":131092082,"published":false}} ``` Response: ``` HTTP/1.1 200 OK {"page":{"shop_id":548380009,"published_at":null,"title":"Terms of Services","handle":"tos","body_html":"<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>","id":131092082,"author":"Dennis","created_at":"2008-07-15T20:00:00-04:00","updated_at":"2025-01-02T11:35:08-05:00","template_suffix":null,"admin_graphql_api_id":"gid://shopify/Page/131092082"}} ``` ##### Show a hidden page Request: ``` PUT /admin/api/unstable/pages/131092082.json {"page":{"id":131092082,"published":true}} ``` Response: ``` HTTP/1.1 200 OK {"page":{"shop_id":548380009,"published_at":"2025-01-02T11:35:09-05:00","title":"Terms of Services","handle":"tos","body_html":"<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>","id":131092082,"author":"Dennis","created_at":"2008-07-15T20:00:00-04:00","updated_at":"2025-01-02T11:35:09-05:00","template_suffix":null,"admin_graphql_api_id":"gid://shopify/Page/131092082"}} ``` ##### Update an existing page completely Request: ``` PUT /admin/api/unstable/pages/131092082.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"}} ``` Response: ``` HTTP/1.1 200 OK {"page":{"shop_id":548380009,"author":"Christopher Gorski","body_html":"<p>Returns accepted if we receive the items <strong>14 days</strong> after purchase.</p>","handle":"new-warranty","title":"New warranty","id":131092082,"created_at":"2008-07-15T20:00:00-04:00","updated_at":"2025-01-02T11:35:20-05:00","published_at":"2008-07-15T20:00:00-04:00","template_suffix":null,"admin_graphql_api_id":"gid://shopify/Page/131092082"}} ``` ##### Update the body HTML of an existing page Request: ``` PUT /admin/api/unstable/pages/131092082.json {"page":{"id":131092082,"body_html":"<p>Returns accepted if we receive the items 14 days after purchase.</p>"}} ``` Response: ``` HTTP/1.1 200 OK {"page":{"shop_id":548380009,"body_html":"<p>Returns accepted if we receive the items 14 days after purchase.</p>","title":"Terms of Services","handle":"tos","id":131092082,"author":"Dennis","created_at":"2008-07-15T20:00:00-04:00","updated_at":"2025-01-02T11:35:13-05:00","published_at":"2008-07-15T20:00:00-04:00","template_suffix":null,"admin_graphql_api_id":"gid://shopify/Page/131092082"}} ``` ## Deletes a page Deletes a page. ### Endpoint /admin/api/#{api_version}/pages/{page_id}.json (DELETE) ### Parameters * api_version (required): * page_id (required): ### Responses #### 200 Deletes a page Examples: ##### Delete a page Request: ``` DELETE /admin/api/unstable/pages/131092082.json ``` Response: ``` HTTP/1.1 200 OK {} ```