Get Started

API Reference / Pages

Unpublish Page

Remove a page from your public site. The page remains in your project as a draft and can be re-published at any time.

Endpoint

HTTP
POST /pages/:id/unpublish

Path Parameters

NameTypeRequiredDescription
idstringYesThe unique page ID

Headers

NameRequiredDescription
AuthorizationYesBearer $PAGEGUN_API_KEY

What Happens on Unpublish

  1. CDN Removal — The page is removed from the global CDN
  2. Status Update — Page status changes to "draft"
  3. Navigation Update — For docs type pages, the navigation tree is regenerated without this page
  4. Webhook Trigger — If configured, a page.unpublished webhook event is sent
  5. Content Preserved — All page content and configuration is kept intact

Response

JSON
{
  "data": {
    "id": "page_xyz789",
    "status": "draft",
    "unpublished_at": "2024-01-22T14:30:00Z"
  }
}

Response Fields

FieldTypeDescription
idstringThe page ID
statusstringAlways "draft" after unpublishing
unpublished_atstringISO 8601 timestamp

Error Responses

StatusCodeDescription
404not_foundPage ID doesn't exist
409not_publishedPage is already in draft status

Examples

Basic Unpublish

Terminal
curl -X POST "https://api.pagegun.com/pages/page_xyz789/unpublish" \
  -H "Authorization: Bearer $PAGEGUN_API_KEY"

Temporary Content Takedown

Terminal
# Unpublish for review
curl -X POST "https://api.pagegun.com/pages/page_xyz789/unpublish" \
  -H "Authorization: Bearer $PAGEGUN_API_KEY"

# Make edits
curl -X PUT "https://api.pagegun.com/pages/page_xyz789" \
  -H "Authorization: Bearer $PAGEGUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"markdown_content": "# Corrected content..."}'

# Re-publish when ready
curl -X POST "https://api.pagegun.com/pages/page_xyz789/publish" \
  -H "Authorization: Bearer $PAGEGUN_API_KEY"

Use Cases

  • Content review: Take a page offline for editing without deleting it
  • Seasonal content: Unpublish holiday or event pages after they expire
  • Compliance: Quickly remove content that needs legal review
  • A/B testing: Rotate pages in and out to test performance
© 2026 PageGun. All rights reserved.