Enable Data Mode

Enable Data Mode for a project. Data Mode transforms PageGun into an encrypted headless CMS, storing content as AES-256-GCM encrypted files on a public CDN.

Endpoint

POST /projects/:id/data-mode/enable

Path Parameters

NameTypeRequiredDescription
idstringYesThe project ID

Headers

NameRequiredDescription
AuthorizationYesBearer $PAGEGUN_API_KEY

What Happens When You Enable Data Mode

  1. Encryption key generated — A unique AES-256-GCM encryption key is created for the project
  2. CDN bucket provisioned — Content storage is set up at content.pagegun.com/{project_id}/
  3. Hosting mode updated — Project switches to Data Mode hosting
  4. Existing pages preserved — All current content remains intact and accessible

Response

{ "data": { "project_id": "proj_abc123", "data_mode": { "enabled": true, "cdn_base": "https://content.pagegun.com/proj_abc123/" }, "encryption_key": "your-content-key-here" } }

Response Fields

FieldTypeDescription
data_mode.enabledbooleanAlways true on success
data_mode.cdn_basestringBase URL for CDN-stored content
encryption_keystringSave this! Used to decrypt content client-side. Only returned once.

⚠️ Important: The encryption_key is only returned in this response. Store it securely — you'll need it to consume content from the CDN.

Error Responses

StatusCodeDescription
404not_foundProject not found
409already_enabledData Mode is already active on this project

Example

curl -X POST "https://api.pagegun.com/projects/proj_abc123/data-mode/enable" \ -H "Authorization: Bearer $PAGEGUN_API_KEY"

JavaScript

const response = await fetch( 'https://api.pagegun.com/projects/proj_abc123/data-mode/enable', { method: 'POST', headers: { 'Authorization': `Bearer ${apiKey}` } } ); const { data } = await response.json(); // ⚠️ Save this key securely — it's only returned once console.log('Encryption key:', data.encryption_key); console.log('CDN base:', data.data_mode.cdn_base);

How Data Mode Works

Data Mode turns PageGun into a headless CMS with encryption:

  1. You publish pages via the API as normal
  2. PageGun encrypts the content with AES-256-GCM using your project's encryption key
  3. Encrypted content is stored on a public CDN (content.pagegun.com)
  4. Your app fetches the encrypted content and decrypts it client-side using the encryption key
  5. Result: Your content is stored on fast public infrastructure, but only your app can read it

Architecture

Your App → fetch(CDN URL) → encrypted blob → decrypt(key) → page content

This gives you the performance of a CDN with the security of encrypted storage.

Use Cases

  • Developer docs hosted in your app — Fetch and render docs content inside your own site
  • Headless blog — Use PageGun as a CMS, render content in your custom frontend
  • Multi-tenant content — Serve encrypted content to different apps/environments
© 2026 PageGun. All rights reserved.