# Page

The Page API returns the store's custom pages and the HTML content of a single page. Both endpoints are open to anonymous visitors.

All Ajax API requests should use [locale-aware URLs](/docs/theme/references/ajax-api/#locale-aware-urls) to give visitors a consistent experience.

## List the custom pages of the store

```text
GET /{locale}/api/front/pages
```

List the custom pages of the store, with the content and the SEO fields of each page.

### Example request

**Example request**

```javascript
fetch(window.SHOPLAZZA.routes.root + '/api/front/pages?page=1&per_page=10')
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### Request parameters

- `page` number

  The page of results to return.
- `per_page` number

  The number of pages per page of results. Defaults to 10.

### Response

**Schema | Example**

- `data` object

  The response payload.

  - `page` number

    Current page number.
  - `per_page` number

    Number of records returned per page.
  - `pages` object[]

    List of custom pages.

    *   Array \[

    - `id` number

      ID of the custom page.
    - `store_id` number

      ID of the store the object belongs to.
    - `origin` string

      Where the page comes from.
    - `title` string

      Title of the custom page.
    - `content` string

      HTML content of the page.
    - `status` number

      Status of the custom page; `1` means active.
    - `created_at` string

      Creation time, in ISO-8601 format.
    - `updated_at` string

      Last update time, in ISO-8601 format.
    - `independent_seo` boolean

      Whether SEO settings are managed independently.
    - `url` string

      Relative URL of the custom page.
    - `meta_title` string

      SEO title used in the page metadata.
    - `meta_keyword` string

      SEO keywords used in the page metadata.
    - `meta_description` string

      SEO description used in the page metadata.
    *   \]
  - `count` number

    Number of custom pages returned.
  - `has_more` number

    Whether more records are available.
- `msg` string

  Result message returned with the response.
- `state` number

  Request result flag; `success` or `0` means the request succeeded.

```json
{
  "data": {
    "page": 1,
    "per_page": 10,
    "pages": [
      {
        "id": 13594997,
        "store_id": 2446407,
        "origin": "openapi",
        "title": "Ajax API Probe Page",
        "content": "<p>Sample custom page used for Ajax API documentation examples.</p>",
        "status": 1,
        "created_at": "1788356532",
        "updated_at": "1788356532",
        "independent_seo": false,
        "url": "/pages/ajax-api-probe-page",
        "meta_title": "Ajax API Probe Page",
        "meta_keyword": "",
        "meta_description": "Sample custom page used for Ajax API documentation examples."
      }
    ],
    "count": 1,
    "has_more": 0
  },
  "msg": "请求成功",
  "state": 0
}
```

## Get a custom page

```text
GET /{locale}/api/front/pages/{page_id}
```

Get one custom page by id.

### Example request

**Example request**

```javascript
fetch(window.SHOPLAZZA.routes.root + '/api/front/pages/13594997')
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### Request parameters

- `page_id` number

  The id of the custom page.

### Response

**Schema | Example**

- `data` object

  The response payload.

  - `id` number

    ID of the custom page.
  - `store_id` number

    ID of the store the object belongs to.
  - `origin` string

    Where the page comes from.
  - `title` string

    Title of the custom page.
  - `content` string

    HTML content of the page.
  - `status` number

    Status of the custom page; `1` means active.
  - `created_at` string

    Creation time, in ISO-8601 format.
  - `updated_at` string

    Last update time, in ISO-8601 format.
  - `independent_seo` boolean

    Whether SEO settings are managed independently.
  - `url` string

    Relative URL of the custom page.
  - `meta_title` string

    SEO title used in the page metadata.
  - `meta_keyword` string

    SEO keywords used in the page metadata.
  - `meta_description` string

    SEO description used in the page metadata.
- `msg` string

  Result message returned with the response.
- `state` number

  Request result flag; `success` or `0` means the request succeeded.

```json
{
  "data": {
    "id": 13594997,
    "store_id": 2446407,
    "origin": "openapi",
    "title": "Ajax API Probe Page",
    "content": "<p>Sample custom page used for Ajax API documentation examples.</p>",
    "status": 1,
    "created_at": "1788356532",
    "updated_at": "1788356532",
    "independent_seo": false,
    "url": "/pages/ajax-api-probe-page",
    "meta_title": "Ajax API Probe Page",
    "meta_keyword": "",
    "meta_description": "Sample custom page used for Ajax API documentation examples."
  },
  "msg": "请求成功",
  "state": 0
}
```
