Unpublish an Entry
Take an entry offline from the public API without deleting it. Unpublishing clears the published_version_id pointer so state=published reads return 404, but all historical versions are retained and remain accessible via the versions endpoints for audit and recovery.
Request
POST /api/{collection}/{uuid}/unpublish 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
- Sets
content_entries.state = 'draft'. - Clears
published_version_idandpublished_version_numberon the entry. - Does not delete any rows in
content_entry_versions— history is preserved. - Public API
state=publishedreads will now return 404 for this entry. - The working draft is untouched;
state=draftreads continue to work.
Response (200)
{ "message": "Content unpublished." }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.unpublish("blog-posts", entryUuid)
// Versions are retained:
const versions = await client.content.versions.list("blog-posts", entryUuid)curl -sS -X POST "https://app.nomacms.com/api/blog-posts/${ENTRY_UUID}/unpublish" \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json"Related
- Publish an Entry - Re-publish later by minting a new version
- Versions - Historical versions remain accessible after unpublish
- Update an Entry - Keep editing the draft while unpublished