Update Page
Update an existing page's content, metadata, or configuration. This endpoint supports partial updates - only the provided fields will be changed, while others remain unchanged.
Endpoint
PUT /pages/:idPath Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique page identifier (e.g., page_xyz789) |
Headers
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $PAGEGUN_API_KEY |
Content-Type | Yes | application/json |
Body Parameters
All fields are optional. Only provided fields will be updated.
| Name | Type | Required | Description |
|---|---|---|---|
title | string | No | Page display name (1-200 characters) |
slug | string | No | URL slug (3-100 characters, lowercase, hyphens allowed) |
subroute | string | No | URL path prefix (e.g., pages, blog, docs) |
status | string | No | Page status: draft, published, or archived |
description | string | No | Page description for admin use (max 500 characters) |
og_image_url | string | No | Social sharing image URL |
meta | object | No | SEO metadata object |
config | object | No | Page configuration (sections for landing pages) |
markdown_content | string | No | Markdown content (for articles and docs) |
Meta Object
| Name | Type | Required | Description |
|---|---|---|---|
title | string | No | Page title for SEO (max 60 characters) |
description | string | No | Meta description for SEO (max 160 characters) |
keywords | string | No | SEO keywords (comma-separated) |
robots | string | No | Robots meta directive (e.g., index, follow) |
Config Object (Landing Pages)
| Name | Type | Required | Description |
|---|---|---|---|
sections | array | No | Array of section objects (replaces entire sections array) |
Response
Returns the updated page object with all current values.
{
"data": {
"id": "page_xyz789",
"title": "Updated Product Landing Page",
"slug": "updated-product-landing",
"subroute": "pages",
"type": "page",
"status": "draft",
"url": "/updated-product-landing",
"description": "Updated description for our main product page",
"og_image_url": "https://example.com/updated-og.jpg",
"meta": {
"title": "Updated Product - Get Started Today",
"description": "Discover our updated product features and benefits.",
"keywords": "product, landing, features, updated",
"robots": "index, follow"
},
"config": {
"sections": [
{
"id": "hero-1",
"type": "hero",
"props": {
"headline": "Updated: Build Amazing Websites",
"subheadline": "Create stunning pages without code - now even better",
"cta_text": "Get Started",
"cta_url": "/signup"
}
}
]
},
"markdown_content": null,
"sections_count": 1,
"word_count": 150,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-21T09:00:00Z"
}
}Examples
Update Basic Information
curl -X PUT "https://api.pagegun.com/pages/page_xyz789" \
-H "Authorization: Bearer $PAGEGUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Product Landing",
"slug": "updated-product-landing",
"description": "Updated description for our product page"
}'Update SEO Metadata
curl -X PUT "https://api.pagegun.com/pages/page_xyz789" \
-H "Authorization: Bearer $PAGEGUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"meta": {
"title": "New SEO Title - Amazing Product",
"description": "Updated meta description for better SEO performance.",
"keywords": "product, landing, conversion, updated"
}
}'Update Page Configuration (Landing Page)
curl -X PUT "https://api.pagegun.com/pages/page_xyz789" \
-H "Authorization: Bearer $PAGEGUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"config": {
"sections": [
{
"id": "hero-1",
"type": "hero",
"props": {
"headline": "Revolutionary Product Launch",
"subheadline": "Experience the future of web development",
"cta_text": "Start Free Trial",
"cta_url": "/signup",
"background_image": "https://example.com/new-hero-bg.jpg"
}
},
{
"id": "features-1",
"type": "features",
"props": {
"title": "Enhanced Features",
"subtitle": "Everything you need to succeed",
"features": [
{
"icon": "⚡",
"title": "Lightning Fast",
"description": "Optimized for maximum performance"
},
{
"icon": "🔒",
"title": "Secure by Default",
"description": "Enterprise-grade security built in"
}
]
}
}
]
}
}'Update Markdown Content (Article)
curl -X PUT "https://api.pagegun.com/pages/page_art456" \
-H "Authorization: Bearer $PAGEGUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated: How to Build Better Landing Pages",
"markdown_content": "# Updated Guide: Building High-Converting Landing Pages\n\nThis updated guide covers the latest best practices...\n\n## What'\''s New\n\n- Enhanced mobile optimization\n- New conversion strategies\n- Updated design trends",
"meta": {
"title": "Updated Landing Page Guide - 2024 Best Practices",
"description": "Learn the latest strategies for building landing pages that convert in 2024."
}
}'Publish a Draft Page
curl -X PUT "https://api.pagegun.com/pages/page_xyz789" \
-H "Authorization: Bearer $PAGEGUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "published"
}'JavaScript Example
const updatePage = async (pageId, updates) => {
const response = await fetch(`https://api.pagegun.com/pages/${pageId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${process.env.PAGEGUN_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(updates)
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
};
// Usage examples
const updated = await updatePage('page_xyz789', {
title: 'New Page Name',
meta: {
title: 'New SEO Title',
description: 'Updated description'
}
});
const published = await updatePage('page_xyz789', {
status: 'published'
});Important Notes
Warning
Config Field Replacement: The config field completely replaces the existing configuration. Always include all sections when updating, not just the changed ones. For partial section updates, retrieve the current config first, modify it, then send the complete updated config.
Note
Status Changes: Changing status to published will make the page immediately visible to visitors. Ensure all content and configuration is ready before publishing.
Tip
Slug Validation: Page slugs must be unique within the project and subroute. The system will validate uniqueness before updating.
Error Responses
400 Bad Request
{
"statusCode": 422,
"name": "invalid_request",
"message": "Validation failed"
}401 Unauthorized
{
"statusCode": 401,
"name": "unauthorized",
"message": "Invalid or missing API key"
}403 Forbidden
{
"statusCode": 403,
"name": "forbidden",
"message": "You don't have permission to update this page"
}404 Not Found
{
"statusCode": 404,
"name": "not_found",
"message": "Page not found"
}409 Conflict
{
"statusCode": 400,
"name": "conflict",
"message": "Slug already exists"
}422 Unprocessable Entity
{
"statusCode": 422,
"name": "validation_error",
"message": "Invalid section configuration"
}