Get Started

API Reference

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

FieldTypeDescription
idstringUnique page identifier
project_idstringID of the parent project
page_namestringDisplay name of the page
slugstringURL slug (e.g., getting-started)
subroutestringParent path prefix (e.g., guides)
typestringPage type: page, post, or doc
markdown_contentstringPage content in Markdown
configobjectPage-level configuration
is_publishedbooleanWhether the page is currently published
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last update timestamp

Page Types

TypeDescription
pageStandard standalone page
postBlog post with date metadata
docDocumentation page with sidebar navigation

URL Structure

The final URL of a published page is determined by subroute and slug:

Text
https://yoursite.com/{subroute}/{slug}

For example, a page with subroute: "guides" and slug: "quickstart" resolves to /guides/quickstart.


List Pages

HTTP
GET /v1/pages

Returns a list of pages, optionally filtered by project.

Query Parameters

NameTypeRequiredDescription
project_idstringYesFilter pages by project ID
limitintegerNoNumber of results. Default: 20, Max: 100
offsetintegerNoNumber of results to skip. Default: 0

Request

Terminal
curl "https://api.pagegun.com/v1/pages?project_id=MgdGoare" \
  -H "Authorization: Bearer pgk_live_xxxxx"
TypeScript
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

JSON
{
  "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

HTTP
POST /v1/pages

Creates a new page within a project.

Request Body

NameTypeRequiredDescription
project_idstringYesID of the parent project
page_namestringYesDisplay name of the page
slugstringYesURL-safe slug (lowercase, hyphens allowed)
subroutestringNoParent path prefix. Default: ""
typestringNoPage type: page, post, or doc. Default: page
markdown_contentstringNoPage content in Markdown
configobjectNoPage-level configuration

Request

Terminal
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."
  }'
TypeScript
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

JSON
{
  "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

HTTP
GET /v1/pages/:id

Retrieves a single page by ID, including its full Markdown content.

Path Parameters

NameTypeRequiredDescription
idstringYesPage ID

Request

Terminal
curl https://api.pagegun.com/v1/pages/DgTgGtE9 \
  -H "Authorization: Bearer pgk_live_xxxxx"
TypeScript
const response = await fetch("https://api.pagegun.com/v1/pages/DgTgGtE9", {
  headers: { Authorization: "Bearer pgk_live_xxxxx" },
});

const { data } = await response.json();

Response

JSON
{
  "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

HTTP
PUT /v1/pages/:id

Updates a page. Supports partial updates — only include the fields you want to change.

Path Parameters

NameTypeRequiredDescription
idstringYesPage ID

Request Body

NameTypeRequiredDescription
page_namestringNoUpdated display name
slugstringNoUpdated URL slug
subroutestringNoUpdated parent path
typestringNoUpdated page type
markdown_contentstringNoUpdated Markdown content
configobjectNoUpdated page configuration

Request

Terminal
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."}'
TypeScript
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

JSON
{
  "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"
  }
}
© 2026 PageGun. All rights reserved.