Publish an Entry
Mint a new immutable version from the entry's current working draft and make it the live snapshot served under state=published.
Publishing is always an explicit action. Saving the entry with PUT / PATCH only mutates the draft — it never changes what public state=published reads return. This gives you the classic draft-and-publish workflow: edit freely, then publish when the copy is ready.
Request
POST /api/{collection}/{uuid}/publish HTTP/1.1
Host: app.nomacms.com
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/jsonRequires the update ability on the token.
Path parameters
| Param | Description |
|---|---|
collection | Collection slug |
uuid | Entry UUID |
No body is required.
What this does
- Captures the current working draft into a new immutable row in
content_entry_versions(with a monotonicversion_number). - Sets
content_entries.state = 'published',published_version_idandpublished_version_numberon the entry. - Resets
is_draft_dirtytofalse. - Enforces plan-based retention (Basic 10, Grow 50, Pro unlimited), pruning the oldest non-live versions if needed.
Response (200)
{
"message": "Content published as v3.",
"version_number": 3,
"entry": { "uuid": "…", "locale": "en", "published_at": "…", "fields": { … } }
}The entry object is the same shape you get from GET /api/{collection}/{uuid}?state=published — rendered from the just-minted snapshot.
Errors
| Status | When |
|---|---|
| 400 | Missing project-id or project cannot be resolved |
| 401 | Missing or invalid bearer token |
| 403 | Token does not have update (or *) |
| 404 | Collection or entry not found |
Example
import { createClient } from "@nomacms/js-sdk"
const client = createClient({
projectId: process.env.NOMA_PROJECT_ID!,
apiKey: process.env.NOMA_API_KEY!,
})
await client.content.patch("blog-posts", entryUuid, {
data: { title: "Launch copy v2" },
})
const { version_number } = await client.content.publish("blog-posts", entryUuid)
console.log("Published as v" + version_number)curl -sS -X POST "https://app.nomacms.com/api/blog-posts/${ENTRY_UUID}/publish" \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json"Related
- Update an Entry - Save changes to the working draft
- Unpublish an Entry - Take the entry offline without deleting history
- Versions - List, inspect, and revert versions