CDN
Contentrain Studio includes a built-in Content Delivery Network for serving your published content through a fast, public API. The CDN builds optimized content from your Git repository and serves it through edge infrastructure.
Managed service / Enterprise Edition
The CDN is an Enterprise Edition feature, gated by the cdn.delivery plan feature and backed by Cloudflare R2 storage. It is available on Contentrain's managed service (Starter plans and above) and on self-hosted Enterprise Edition deployments. It is not available in the self-hosted Community Edition, which has no CDN storage backend.
How the CDN Works
Git Repository → Build Pipeline → CDN Storage → Public API- Content is committed to your repository through Studio
- A build is triggered (manually or automatically after a merge)
- The build pipeline reads content, filters by status (
publishedonly), and serializes to optimized JSON - Content is uploaded to CDN storage
- Consumers fetch content through the public delivery endpoint
Enabling CDN
CDN is available on Starter plans and above. To enable it for a project:
- Open the project sidebar
- Click CDN to open the CDN panel
- Toggle Enable CDN in the settings
- Create an API key for authentication

API Key Management
CDN access requires an API key. Keys are used in the Authorization header of requests to the delivery endpoint.
Creating a Key
- In the CDN panel, navigate to the Keys section
- Click Create key
- Enter a descriptive name for the key
- The key is generated and shown once — copy it immediately
WARNING
API keys are shown only once at creation time. Studio stores only the SHA-256 hash of the key. If you lose the key, you must create a new one.
Key Format
CDN API keys follow the format:
crn_live_{random-base62-string}Example: crn_live_7K2mX9pQ4rT6vW3nY8sB1hJ5
Deleting a Key
To revoke access, delete the key from the CDN panel. This takes effect immediately — any requests using the deleted key will receive a 401 Unauthorized response.
Public Delivery Endpoint
Content is served through a REST-style endpoint:
GET /api/cdn/v1/{projectId}/{path}
Authorization: Bearer crn_live_...Path Structure
Objects are keyed by model ID (the domain is not part of the CDN path — it is written flat by the build pipeline):
| Path | Returns |
|---|---|
content/{modelId}/{locale}.json | Published entries for an i18n collection/singleton/dictionary, by locale |
content/{modelId}/data.json | Published entries for a non-i18n model |
documents/{modelId}/{slug}/{locale}.json | A single document entry |
models/{modelId}.json | A model definition |
models/_index.json | Summary index of all models |
_manifest.json | Build manifest (commit SHA, locales, domains, model list) |
For example, the English entries of a blog-post collection are served at content/blog-post/en.json.
Response Format
The endpoint returns the raw published-content JSON file straight from CDN storage, with Content-Type: application/json and an ETag header (conditional If-None-Match requests return 304). Collection and singleton files are an object map keyed by entry ID, containing only entries with published status:
{
"a1b2c3d4e5f6": {
"title": "Hello World",
"slug": "hello-world",
"body": "..."
},
"g7h8i9j0k1l2": {
"title": "Second Post",
"slug": "second-post",
"body": "..."
}
}Authentication
All CDN requests require a valid API key in the Authorization header:
curl -H "Authorization: Bearer crn_live_..." \
https://your-studio.com/api/cdn/v1/{projectId}/content/blog-post/en.jsonBuild Pipeline
Triggering a Build
Builds can be triggered in two ways:
- Manual trigger — Click Trigger Build in the CDN panel
- Automatic — After a branch merge completes (when configured)
Build Process
Each build:
- Reads the latest content from your Git repository
- Loads all model definitions
- Filters content entries to include only
publishedstatus - Serializes Markdown content to HTML (for document models)
- Uploads optimized JSON to CDN storage
- Cleans up stale files from previous builds
Build Results
After a build completes, you can see:
| Field | Description |
|---|---|
buildId | Unique build identifier |
commitSha | The Git commit the build was created from |
filesUploaded | Number of content files processed |
filesDeleted | Number of stale files removed |
totalSizeBytes | Total size of the uploaded content |
changedModels | Which models had content changes |
durationMs | Build duration in milliseconds |
Build History
The CDN panel shows a history of recent builds with their status, timing, and output details.
TIP
If content looks stale on the CDN, trigger a manual build to ensure the latest published content is served.
CDN Security
- API key authentication — Every request must include a valid key
- Rate limiting — Requests are rate-limited per key (configurable per plan)
- Allowed origins — Configure CORS origins per API key for browser-based access
- Published only — The CDN only serves entries with
publishedstatus; draft, archived, and rejected content is never exposed
Plan Limits
| Feature | Free | Starter | Pro | Enterprise |
|---|---|---|---|---|
| CDN delivery | No | Yes | Yes | Yes |
| API keys | 0 | 3 | 10 | Unlimited |
| Bandwidth | 0 | 2GB/mo | 20GB/mo | Unlimited |
| Preview branches | No | No | Yes | Yes |
| Custom domain | No | No | No | Yes |
Next Steps
- Content Editing — Publish content for CDN delivery
- Webhooks — Get notified when CDN builds complete
- Billing & Plans — Upgrade for more CDN capacity