API Reference / Pages
Get Page
Retrieve a single page by ID with complete configuration, content, and metadata. This endpoint returns different data structures based on the page type.
Endpoint
HTTP
GET /pages/:idPath Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique page identifier (e.g., page_xyz789) |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
include_sections | boolean | No | Include detailed section configuration (default: true) |
include_markdown | boolean | No | Include raw markdown content for article/docs pages (default: true) |
format | string | No | Response format: json (default) or markdown |
Headers
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $PAGEGUN_API_KEY |
Content-Type | No | application/json |
Response
Returns a page object with complete configuration and content data.
Page Type: Landing Page
JSON
{
"data": {
"id": "page_xyz789",
"page_name": "Product Landing Page",
"slug": "product-landing",
"subroute": "pages",
"type": "page",
"status": "published",
"url": "/product-landing",
"description": "Our main product landing page with hero, features, and CTA",
"og_image_url": "https://example.com/product-og.jpg",
"meta": {
"title": "Amazing Product - Get Started Today",
"description": "Discover our amazing product features and benefits.",
"keywords": "product, landing, features",
"robots": "index, follow"
},
"config": {
"sections": [
{
"id": "hero-1",
"type": "hero",
"props": {
"headline": "Build Amazing Websites",
"subheadline": "Create stunning pages without code",
"cta_text": "Get Started",
"cta_url": "/signup",
"background_image": "https://example.com/hero-bg.jpg"
}
},
{
"id": "features-1",
"type": "features",
"props": {
"title": "Why Choose Us",
"features": [
{
"icon": "⚡",
"title": "Lightning Fast",
"description": "Optimized for speed and performance"
}
]
}
}
]
},
"markdown_content": null,
"sections_count": 2,
"word_count": 245,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:00:00Z"
}
}Page Type: Article
JSON
{
"data": {
"id": "page_art456",
"page_name": "How to Build Better Landing Pages",
"slug": "build-better-landing-pages",
"subroute": "blog",
"type": "article",
"status": "published",
"url": "/blog/build-better-landing-pages",
"description": "Learn the best practices for creating high-converting landing pages",
"og_image_url": "https://example.com/article-og.jpg",
"meta": {
"title": "How to Build Better Landing Pages - Best Practices Guide",
"description": "Learn proven strategies to create landing pages that convert visitors into customers.",
"keywords": "landing pages, conversion, marketing, design",
"robots": "index, follow"
},
"config": {
"sections": []
},
"markdown_content": "# How to Build Better Landing Pages\n\nLanding pages are crucial for converting visitors...\n\n## Key Principles\n\n1. **Clear Value Proposition**\n2. **Compelling Headlines**\n3. **Strong Call-to-Action**",
"sections_count": 0,
"word_count": 1250,
"publish_date": "2024-01-18T00:00:00Z",
"author": {
"name": "John Smith",
"avatar": "https://example.com/john.jpg"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:00:00Z"
}
}Page Type: Documentation
JSON
{
"data": {
"id": "page_doc789",
"page_name": "API Authentication",
"slug": "authentication",
"subroute": "docs",
"type": "docs",
"status": "published",
"url": "/docs/api-keys",
"description": "Learn how to authenticate with our API",
"og_image_url": null,
"meta": {
"title": "API Authentication - Documentation",
"description": "Complete guide to authenticating with the PageGun API.",
"keywords": "api, authentication, bearer token",
"robots": "index, follow"
},
"config": {
"sections": []
},
"markdown_content": "# API Authentication\n\nAll API requests require authentication...",
"sections_count": 0,
"word_count": 850,
"nav_order": 2,
"parent_page": "page_doc123",
"created_at": "2024-01-12T08:00:00Z",
"updated_at": "2024-01-18T16:30:00Z"
}
}Response Fields
Base Page Object
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the page |
page_name | string | Display name of the page |
slug | string | URL slug for the page |
subroute | string | Subroute/folder for the page |
type | string | Page type: page, article, docs, or item |
status | string | Publishing status: draft, published, or archived |
url | string | Full URL path for the page |
description | string | Page description for admin use |
og_image_url | string | Social sharing image URL |
meta | object | SEO metadata |
config | object | Page configuration (sections for landing pages) |
markdown_content | string | Raw markdown content (articles/docs only) |
sections_count | integer | Number of content sections |
word_count | integer | Approximate word count |
created_at | string | ISO 8601 timestamp when page was created |
updated_at | string | ISO 8601 timestamp when page was last modified |
Meta Object
| Field | Type | Description |
|---|---|---|
title | string | Page title for SEO |
description | string | Meta description for SEO |
keywords | string | SEO keywords (comma-separated) |
robots | string | Robots meta directive |
Config Object (Landing Pages)
| Field | Type | Description |
|---|---|---|
sections | array | Array of section configuration objects |
Additional Fields (Articles)
| Field | Type | Description |
|---|---|---|
publish_date | string | ISO 8601 timestamp for article publication |
author | object | Author information |
Additional Fields (Documentation)
| Field | Type | Description |
|---|---|---|
nav_order | integer | Navigation order in documentation |
parent_page | string | Parent page ID for nested docs |
Examples
Basic Request
Terminal
curl -X GET "https://api.pagegun.com/pages/page_xyz789" \
-H "Authorization: Bearer $PAGEGUN_API_KEY"Minimal Response (No Sections)
Terminal
curl -X GET "https://api.pagegun.com/pages/page_xyz789?include_sections=false" \
-H "Authorization: Bearer $PAGEGUN_API_KEY"Markdown Format Response
Terminal
curl -X GET "https://api.pagegun.com/pages/page_art456?format=markdown" \
-H "Authorization: Bearer $PAGEGUN_API_KEY"JavaScript Example
JavaScript
const getPage = async (pageId, options = {}) => {
const params = new URLSearchParams(options);
const queryString = params.toString() ? `?${params}` : '';
const response = await fetch(`https://api.pagegun.com/pages/${pageId}${queryString}`, {
headers: {
'Authorization': `Bearer ${process.env.PAGEGUN_API_KEY}`
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
};
// Usage examples
const page = await getPage('page_xyz789');
const articleMarkdown = await getPage('page_art456', { format: 'markdown' });
const minimalPage = await getPage('page_xyz789', { include_sections: false });Error Responses
401 Unauthorized
JSON
{
"statusCode": 401,
"name": "unauthorized",
"message": "Invalid or missing API key"
}403 Forbidden
JSON
{
"statusCode": 403,
"name": "forbidden",
"message": "You don't have access to this page"
}404 Not Found
JSON
{
"statusCode": 404,
"name": "not_found",
"message": "Page not found"
}400 Bad Request
JSON
{
"statusCode": 422,
"name": "invalid_request",
"message": "Invalid query parameter"
}429 Too Many Requests
JSON
{
"statusCode": 429,
"name": "rate_limit_exceeded",
"message": "Too many requests. Please try again later."
}