Update Project

Update a project's configuration including name, domain, settings, and hosting options. Only provided fields will be updated; others remain unchanged.

Endpoint

PUT /projects/:id

Path Parameters

NameTypeRequiredDescription
idstringYesUnique project identifier (e.g., proj_abc123)

Headers

NameRequiredDescription
AuthorizationYesBearer $PAGEGUN_API_KEY
Content-TypeYesapplication/json

Body Parameters

NameTypeRequiredDescription
namestringNoProject display name (1-100 characters)
domainstringNoCustom domain (e.g., mywebsite.com)
statusstringNoProject status: active or archived
settingsobjectNoProject configuration settings
hostingobjectNoHosting and domain configuration

Settings Object

NameTypeRequiredDescription
themestringNoVisual theme identifier
faviconstringNoURL to favicon image (PNG, ICO, or SVG)
logostringNoURL to logo image (PNG, JPG, or SVG)
custom_cssstringNoCustom CSS styles (max 50KB)
google_analyticsstringNoGoogle Analytics tracking ID
meta_descriptionstringNoDefault meta description for SEO (max 160 characters)
social_imagestringNoDefault social sharing image URL

Hosting Object

NameTypeRequiredDescription
modestringNoHosting mode: full_host, rewrite, or data_mode
subdomainstringNoPageGun subdomain (3-50 characters, lowercase)
custom_domainstringNoCustom domain name
ssl_enabledbooleanNoEnable SSL certificate for custom domain
cdn_enabledbooleanNoEnable CDN acceleration

Response

Returns the updated project object with all current values.

{ "data": { "id": "proj_abc123", "name": "Updated Website Name", "slug": "updated-website-name", "domain": "newdomain.com", "status": "active", "hosting_mode": "full_host", "page_count": 12, "settings": { "theme": "modern", "favicon": "https://example.com/new-favicon.ico", "logo": "https://example.com/new-logo.png", "custom_css": "body { font-family: 'Inter', sans-serif; }", "google_analytics": "GA-XXXXXXXX-X", "meta_description": "My updated website description", "social_image": "https://example.com/new-og-image.png" }, "hosting": { "mode": "full_host", "subdomain": "mysite", "custom_domain": "newdomain.com", "ssl_enabled": true, "cdn_enabled": true }, "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/projects/proj_abc123" \ -H "Authorization: Bearer $PAGEGUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "My Awesome Website", "domain": "awesome-site.com" }'

Update Settings Only

curl -X PUT "https://api.pagegun.com/projects/proj_abc123" \ -H "Authorization: Bearer $PAGEGUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "settings": { "theme": "modern", "google_analytics": "GA-XXXXXXXX-X", "meta_description": "Updated SEO description" } }'

Update Hosting Configuration

curl -X PUT "https://api.pagegun.com/projects/proj_abc123" \ -H "Authorization: Bearer $PAGEGUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "hosting": { "mode": "rewrite", "custom_domain": "mysite.com", "ssl_enabled": true, "cdn_enabled": true } }'

Archive Project

curl -X PUT "https://api.pagegun.com/projects/proj_abc123" \ -H "Authorization: Bearer $PAGEGUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "status": "archived" }'

JavaScript Example

const updateProject = async (projectId, updates) => { const response = await fetch(`https://api.pagegun.com/projects/${projectId}`, { 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 const updated = await updateProject('proj_abc123', { name: 'My New Site Name', settings: { theme: 'modern', meta_description: 'Updated description' } });

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 project" }

404 Not Found

{ "statusCode": 404, "name": "not_found", "message": "Project not found" }

409 Conflict

{ "statusCode": 400, "name": "conflict", "message": "Domain already in use" }

422 Unprocessable Entity

{ "statusCode": 422, "name": "validation_error", "message": "Custom CSS exceeds maximum size limit" }
© 2026 PageGun. All rights reserved.