Delete an Entry
Deletes a content entry. By default the row is soft-deleted; use force for a hard delete.
Request
DELETE /api/{collection}/{uuid} HTTP/1.1
Host: app.nomacms.com
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/jsonRequires the delete ability on the token.
Path parameters
| Param | Description |
|---|---|
collection | Collection slug |
uuid | Entry UUID |
Query parameters
| Param | Description |
|---|---|
force | If truthy (1, true), performs a force delete: field values and groups are removed and the entry is permanently deleted. If omitted or false, the entry is soft-deleted. |
Response (200)
JSON object:
| Field | Type | Description |
|---|---|---|
message | string | Content deleted. |
Errors
| Status | When |
|---|---|
| 400 | Missing project-id or project cannot be resolved |
| 401 | Missing or invalid bearer token |
| 403 | Token does not have delete (or *) |
| 404 | Collection or entry not found |
| 429 | Rate limited |
Example
import { createClient } from "@nomacms/js-sdk"
const client = createClient({
projectId: process.env.NOMA_PROJECT_ID!,
apiKey: process.env.NOMA_API_KEY!,
})
// Soft delete (default)
await client.content.delete("blog-posts", entryUuid)
// Force delete (hard delete) — use one or the other for the same entry
// await client.content.delete("blog-posts", entryUuid, true)import axios from "axios"
async function main() {
const url = `https://app.nomacms.com/api/blog-posts/${encodeURIComponent(entryUuid)}`
const headers = {
"project-id": process.env.NOMA_PROJECT_ID!,
Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
Accept: "application/json",
}
// Soft delete
const { data } = await axios.delete(url, { headers })
console.log(data)
// Force delete — use instead of soft, not after it (same entry)
// const { data } = await axios.delete(url, { params: { force: 1 }, headers })
}
void main()<?php
$uuid = getenv('ENTRY_UUID');
$url = 'https://app.nomacms.com/api/blog-posts/' . rawurlencode($uuid);
// Soft delete
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => [
'project-id: ' . getenv('NOMA_PROJECT_ID'),
'Authorization: Bearer ' . getenv('NOMA_API_KEY'),
'Accept: application/json',
],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
// Force delete: use $url . '?force=1' with the same options above# Soft delete
curl -sS -X DELETE "https://app.nomacms.com/api/blog-posts/${ENTRY_UUID}" \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json"
# Force delete
curl -sS -X DELETE "https://app.nomacms.com/api/blog-posts/${ENTRY_UUID}?force=1" \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json"package main
import (
"io"
"net/http"
"net/url"
"os"
)
func main() {
endpoint := "https://app.nomacms.com/api/blog-posts/" + url.PathEscape(os.Getenv("ENTRY_UUID"))
// Force delete: use endpoint + "?force=1" instead
req, err := http.NewRequest("DELETE", endpoint, nil)
if err != nil {
panic(err)
}
req.Header.Set("project-id", os.Getenv("NOMA_PROJECT_ID"))
req.Header.Set("Authorization", "Bearer "+os.Getenv("NOMA_API_KEY"))
req.Header.Set("Accept", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
_, _ = io.Copy(os.Stdout, res.Body)
}require "net/http"
require "uri"
entry_uuid = ENV.fetch("ENTRY_UUID")
uri = URI("https://app.nomacms.com/api/blog-posts/#{entry_uuid}")
# Soft delete
req = Net::HTTP::Delete.new(uri)
req["project-id"] = ENV.fetch("NOMA_PROJECT_ID")
req["Authorization"] = "Bearer #{ENV.fetch('NOMA_API_KEY')}"
req["Accept"] = "application/json"
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
puts http.request(req).body
end
# Force delete: set uri.query = "force=1" before Net::HTTP::Delete.new(uri)import os
import urllib.parse
import urllib.request
entry_uuid = os.environ["ENTRY_UUID"]
path = "/api/blog-posts/" + urllib.parse.quote(entry_uuid, safe="")
url = f"https://app.nomacms.com{path}"
# Force delete: f"https://app.nomacms.com{path}?force=1"
req = urllib.request.Request(
url,
headers={
"project-id": os.environ["NOMA_PROJECT_ID"],
"Authorization": f"Bearer {os.environ['NOMA_API_KEY']}",
"Accept": "application/json",
},
method="DELETE",
)
with urllib.request.urlopen(req) as res:
print(res.read().decode())Related
- Bulk operations - Delete many entries at once
- JavaScript SDK -
content.delete