API Reference / Data Mode
Disable Data Mode
Disable Data Mode for a project and revert to standard hosting (Full Host or Rewrite).
Endpoint
HTTP
POST /projects/:id/data-mode/disablePath Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The project ID |
Headers
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $PAGEGUN_API_KEY |
What Happens When You Disable Data Mode
- CDN content retained — Existing encrypted files remain on the CDN but are no longer updated
- Hosting mode reverts — Project switches back to the previous hosting mode (Full Host or Rewrite)
- Pages require re-publish — You'll need to re-publish pages to generate non-encrypted versions
- Encryption key preserved — The key remains valid for reading existing CDN content
Response
JSON
{
"data": {
"project_id": "proj_abc123",
"data_mode": {
"enabled": false,
"cdn_base": null
}
}
}Error Responses
| Status | Code | Description |
|---|---|---|
| 404 | not_found | Project not found |
| 409 | not_enabled | Data Mode is not currently active |
Example
Terminal
curl -X POST "https://api.pagegun.com/projects/proj_abc123/data-mode/disable" \
-H "Authorization: Bearer $PAGEGUN_API_KEY"Migration Considerations
Before disabling Data Mode:
- Re-publish all pages after disabling to generate standard (non-encrypted) versions
- Update your frontend to stop fetching from the CDN endpoint
- Keep your encryption key if you need to access previously encrypted CDN content
- Webhook consumers should be prepared for a burst of
page.publishedevents during re-publishing
Migration Script Example
Terminal
# After disabling Data Mode, re-publish all pages
PAGES=$(curl -s "https://api.pagegun.com/pages?project_id=proj_abc123" \
-H "Authorization: Bearer $PAGEGUN_API_KEY" | jq -r '.data[].id')
for PAGE_ID in $PAGES; do
curl -s -X POST "https://api.pagegun.com/pages/$PAGE_ID/publish" \
-H "Authorization: Bearer $PAGEGUN_API_KEY"
echo "Published: $PAGE_ID"
sleep 0.5 # Respect rate limits
doneRelated
- Enable Data Mode — Turn on Data Mode
- Hosting Modes — Compare all hosting options