Get Started

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/:id

Path Parameters

NameTypeRequiredDescription
idstringYesUnique page identifier (e.g., page_xyz789)

Query Parameters

NameTypeRequiredDescription
include_sectionsbooleanNoInclude detailed section configuration (default: true)
include_markdownbooleanNoInclude raw markdown content for article/docs pages (default: true)
formatstringNoResponse format: json (default) or markdown

Headers

NameRequiredDescription
AuthorizationYesBearer $PAGEGUN_API_KEY
Content-TypeNoapplication/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

FieldTypeDescription
idstringUnique identifier for the page
page_namestringDisplay name of the page
slugstringURL slug for the page
subroutestringSubroute/folder for the page
typestringPage type: page, article, docs, or item
statusstringPublishing status: draft, published, or archived
urlstringFull URL path for the page
descriptionstringPage description for admin use
og_image_urlstringSocial sharing image URL
metaobjectSEO metadata
configobjectPage configuration (sections for landing pages)
markdown_contentstringRaw markdown content (articles/docs only)
sections_countintegerNumber of content sections
word_countintegerApproximate word count
created_atstringISO 8601 timestamp when page was created
updated_atstringISO 8601 timestamp when page was last modified

Meta Object

FieldTypeDescription
titlestringPage title for SEO
descriptionstringMeta description for SEO
keywordsstringSEO keywords (comma-separated)
robotsstringRobots meta directive

Config Object (Landing Pages)

FieldTypeDescription
sectionsarrayArray of section configuration objects

Additional Fields (Articles)

FieldTypeDescription
publish_datestringISO 8601 timestamp for article publication
authorobjectAuthor information

Additional Fields (Documentation)

FieldTypeDescription
nav_orderintegerNavigation order in documentation
parent_pagestringParent 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."
}
© 2026 PageGun. All rights reserved.