Pages
Pages are the core content unit in PageGun. Each page belongs to a project and can be published to CDN. Pages support Markdown content and can be organized using slugs and subroutes.
The Page Object
| Field | Type | Description |
|---|---|---|
id | string | Unique page identifier |
project_id | string | ID of the parent project |
page_name | string | Display name of the page |
slug | string | URL slug (e.g., getting-started) |
subroute | string | Parent path prefix (e.g., guides) |
type | string | Page type: page, post, or doc |
markdown_content | string | Page content in Markdown |
config | object | Page-level configuration |
is_published | boolean | Whether the page is currently published |
created_at | string | ISO 8601 creation timestamp |
updated_at | string | ISO 8601 last update timestamp |
Page Types
| Type | Description |
|---|---|
page | Standard standalone page |
post | Blog post with date metadata |
doc | Documentation page with sidebar navigation |
URL Structure
The final URL of a published page is determined by subroute and slug:
https://yoursite.com/{subroute}/{slug}For example, a page with subroute: "guides" and slug: "quickstart" resolves to /guides/quickstart.
List Pages
GET /v1/pagesReturns a list of pages, optionally filtered by project.
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | Filter pages by project ID |
limit | integer | No | Number of results. Default: 20, Max: 100 |
offset | integer | No | Number of results to skip. Default: 0 |
Request
curl "https://api.pagegun.com/v1/pages?project_id=MgdGoare" \
-H "Authorization: Bearer pgk_live_xxxxx"const response = await fetch(
"https://api.pagegun.com/v1/pages?project_id=MgdGoare",
{ headers: { Authorization: "Bearer pgk_live_xxxxx" } }
);
const { data } = await response.json();Response
{
"success": true,
"data": [
{
"id": "DgTgGtE9",
"project_id": "MgdGoare",
"page_name": "Introduction",
"slug": "introduction",
"subroute": "api-reference",
"type": "doc",
"is_published": true,
"created_at": "2024-01-15T08:30:00Z",
"updated_at": "2024-02-01T12:00:00Z"
}
],
"has_more": false,
"total": 1
}Create Page
POST /v1/pagesCreates a new page within a project.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | ID of the parent project |
page_name | string | Yes | Display name of the page |
slug | string | Yes | URL-safe slug (lowercase, hyphens allowed) |
subroute | string | No | Parent path prefix. Default: "" |
type | string | No | Page type: page, post, or doc. Default: page |
markdown_content | string | No | Page content in Markdown |
config | object | No | Page-level configuration |
Request
curl -X POST https://api.pagegun.com/v1/pages \
-H "Authorization: Bearer pgk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"project_id": "MgdGoare",
"page_name": "Getting Started",
"slug": "getting-started",
"subroute": "guides",
"type": "doc",
"markdown_content": "# Getting Started\n\nWelcome to PageGun."
}'const response = await fetch("https://api.pagegun.com/v1/pages", {
method: "POST",
headers: {
Authorization: "Bearer pgk_live_xxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
project_id: "MgdGoare",
page_name: "Getting Started",
slug: "getting-started",
subroute: "guides",
type: "doc",
markdown_content: "# Getting Started\n\nWelcome to PageGun.",
}),
});
const { data } = await response.json();Response 201 Created
{
"success": true,
"data": {
"id": "xYzAbCdE",
"project_id": "MgdGoare",
"page_name": "Getting Started",
"slug": "getting-started",
"subroute": "guides",
"type": "doc",
"markdown_content": "# Getting Started\n\nWelcome to PageGun.",
"config": {},
"is_published": false,
"created_at": "2024-03-01T10:00:00Z",
"updated_at": "2024-03-01T10:00:00Z"
}
}Get Page
GET /v1/pages/:idRetrieves a single page by ID, including its full Markdown content.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Page ID |
Request
curl https://api.pagegun.com/v1/pages/DgTgGtE9 \
-H "Authorization: Bearer pgk_live_xxxxx"const response = await fetch("https://api.pagegun.com/v1/pages/DgTgGtE9", {
headers: { Authorization: "Bearer pgk_live_xxxxx" },
});
const { data } = await response.json();Response
{
"success": true,
"data": {
"id": "DgTgGtE9",
"project_id": "MgdGoare",
"page_name": "Introduction",
"slug": "introduction",
"subroute": "api-reference",
"type": "doc",
"markdown_content": "# Introduction\n\nPageGun API lets you...",
"config": {},
"is_published": true,
"created_at": "2024-01-15T08:30:00Z",
"updated_at": "2024-02-01T12:00:00Z"
}
}Update Page
PUT /v1/pages/:idUpdates a page. Supports partial updates — only include the fields you want to change.
Note
Updating a page does not automatically republish it. Call the publish endpoint to push changes live.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Page ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
page_name | string | No | Updated display name |
slug | string | No | Updated URL slug |
subroute | string | No | Updated parent path |
type | string | No | Updated page type |
markdown_content | string | No | Updated Markdown content |
config | object | No | Updated page configuration |
Request
curl -X PUT https://api.pagegun.com/v1/pages/DgTgGtE9 \
-H "Authorization: Bearer pgk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{"markdown_content": "# Introduction\n\nUpdated content here."}'const response = await fetch("https://api.pagegun.com/v1/pages/DgTgGtE9", {
method: "PUT",
headers: {
Authorization: "Bearer pgk_live_xxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
markdown_content: "# Introduction\n\nUpdated content here.",
}),
});
const { data } = await response.json();Response
{
"success": true,
"data": {
"id": "DgTgGtE9",
"project_id": "MgdGoare",
"page_name": "Introduction",
"slug": "introduction",
"subroute": "api-reference",
"type": "doc",
"markdown_content": "# Introduction\n\nUpdated content here.",
"config": {},
"is_published": true,
"created_at": "2024-01-15T08:30:00Z",
"updated_at": "2024-03-15T14:30:00Z"
}
}