Get Started

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/disable

Path Parameters

NameTypeRequiredDescription
idstringYesThe project ID

Headers

NameRequiredDescription
AuthorizationYesBearer $PAGEGUN_API_KEY

What Happens When You Disable Data Mode

  1. CDN content retained — Existing encrypted files remain on the CDN but are no longer updated
  2. Hosting mode reverts — Project switches back to the previous hosting mode (Full Host or Rewrite)
  3. Pages require re-publish — You'll need to re-publish pages to generate non-encrypted versions
  4. 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

StatusCodeDescription
404not_foundProject not found
409not_enabledData 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.published events 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
done
© 2026 PageGun. All rights reserved.