> For the complete documentation index, see [llms.txt](https://api-docs.devhub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.devhub.com/content-resources/pages.md).

# Pages

Covered in this doc:

* [List pages](/content-resources/pages.md#list-pages)
* [Get a single page](/content-resources/pages.md#get-a-single-page)
* [Create a page](/content-resources/pages.md#create-a-page)
* [Updating a page](/content-resources/pages.md#updating-a-page)

## List pages

List all pages within a Site

```
GET /api/v2/pages/?site_id=12345
```

### Parameters

| Name      | Type     | Description                                                 |
| --------- | -------- | ----------------------------------------------------------- |
| `site_id` | `string` | **required** ID of the `Site` you want to get the pages for |

### Response

```
{
  "meta": {
    "limit": 20,
    "next": "/api/v2/pages/?limit=20&offset=20",
    "offset": 0,
    "previous": null,
    "total_count": 5
  },
  "objects": [
    {
      "active": true,
      "id": 22225773,
      "name": "Home",
      "nofollow": false,
      "path": "/",
      "resource_uri": "/api/v2/pages/22225773/",
      "site_id": 12345,
      "type": "default"
    },
    {
      "active": true,
      "id": 22225774,
      "name": "Contact Us",
      "nofollow": false,
      "path": "/contact-us/",
      "resource_uri": "/api/v2/pages/22225774/",
      "site_id": 12345,
      "type": "default"
    },
    ...
  ]
}
```

## Get a single page

Fetch the Page detail using the `Page.id`

```
GET /api/v2/pages/:id/
```

### Response

```
{
  "site_id": "12345",
  "path": "/",
  "title": "Site Home Page",
  "name": "Home",
  "column_widths": [[50, 50]],
  "modules": [
    {
      "module": "contact_info",
      "column": 1,
      "order": 1,
      "row": 1
    },
    {
      "module": "content",
      "column": 2,
      "order": 1,
      "row": 1,
      "content": "<h1>Here is some content</h1><p>You can even access site meta data like ${business_name} and ${city}</p>"
    },
    {
      "module": "googlemaps",
      "column": 2,
      "order": 2,
      "row": 1
    },
    {
      "module": "about",
      "column": 2,
      "order": 3,
      "row": 1
    },
    {
      "module": "embed",
      "column": 2,
      "order": 4,
      "row": 1,
      "content": "<script src="..."></script>",
      "props": {
        "render_template": true
      }
    }
  ]
}
```

## Create a page

```
POST /api/v2/pages/
```

### Parameters

| Name            | Type              | Description                                                                                                                                                                                           |
| --------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `site_id`       | `integer`         | **required**                                                                                                                                                                                          |
| `name`          | `string`          | **required** Name of the page. Used in navigation menus and buttons                                                                                                                                   |
|                 |                   |                                                                                                                                                                                                       |
| **Optional**    |                   |                                                                                                                                                                                                       |
| `column_widths` | `list` of `list`s | Percentage widths of the rows and columns within the Page. Examples: Single column page `[[100]]` *(default)*, Two columns within one row `[[50, 50]]`, Multiple rows and columns `[[100], [50, 50]]` |
| `modules`       | `list`            | List of Page Module objects to publish to the Page with positional details including `row`, `column`, and `order`                                                                                     |
| `path`          | `string`          | Specific path within the Site where you want to publish the page (i.e. `/contact-us/`)                                                                                                                |
| `title`         | `string`          | HTML `<title>` tag for the Page. Defaults to the `name` parameter                                                                                                                                     |
| `clone_id`      | `integer`         | Page ID of a page you want to duplicate/clone. More info under the Clone/Duplicate example                                                                                                            |

#### Example

```
{
  "name": "Our Services",
  "path": "/our-services/",
  "site_id": 12345
}
```

### Response

A status code of `201 created` is returned on a successful creation and contains the created page object as JSON. See the [Get a single page](/content-resources/pages.md#get-a-single-page) section for an example Page object.

### Cloning/duplicating a page

We have a `clone_id` parameter that can be used to easily duplicate/clone an entire page, including all of its modules and content.

This allows for a simple payload without the need to provide all the modules and page fields from the original.

**Example:**

```
{
  "clone_id": 512345,
  "site_id": 12345,
  "name": "Duplicated page name"
}
```

## Update a page

```
PUT /api/v2/pages/:id/
```

You can `PUT` a partial or full object to the detail endpoint to update/change values on the Page object. If using a partial object, you must insure that the primary page `id` is part of the payload.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api-docs.devhub.com/content-resources/pages.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
