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/unpublishPath Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The unique page ID |
Headers
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $PAGEGUN_API_KEY |
What Happens on Unpublish
- CDN Removal — The page is removed from the global CDN
- Status Update — Page status changes to
"draft" - Navigation Update — For
docstype pages, the navigation tree is regenerated without this page - Webhook Trigger — If configured, a
page.unpublishedwebhook event is sent - 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
| Field | Type | Description |
|---|---|---|
id | string | The page ID |
status | string | Always "draft" after unpublishing |
unpublished_at | string | ISO 8601 timestamp |
Error Responses
| Status | Code | Description |
|---|---|---|
| 404 | not_found | Page ID doesn't exist |
| 409 | not_published | Page 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