Delete an Entry

Delete an Entry

This endpoint deletes (soft-deletes) a content entry.

Endpoint

[DELETE]

/{collection_slug}/{entry_uuid}

Permissions

This endpoint requires a token with the delete ability.

Path Parameters

NameRequiredDescription
collection_slugYesThe unique slug of the collection.
entry_uuidYesThe unique identifier of the entry to delete.

Query Parameters

NameRequiredDescription
forceNoIf set to true or 1, the entry will be permanently deleted. This is irreversible.

Headers

NameRequiredDescription
AcceptYesSpecifies the response content type. Must be application/json.
AuthorizationYesRequired. Must be a Bearer token with delete scope.
project-idYesThe unique identifier for the project.

Example Requests

import { createClient } from '@elmapicms/js-sdk';
 
const client = createClient(
  'https://your-domain.com/api',
  'YOUR_API_TOKEN',
  'YOUR_PROJECT_UUID'
);
 
// Soft delete (move to trash)
await client.deleteEntry('blog-posts', 'a1b2c3d4-e5f6-7890-1234-567890abcdef');
 
// Permanently delete (irreversible)
await client.deleteEntry('blog-posts', 'a1b2c3d4-e5f6-7890-1234-567890abcdef', true);
const collectionSlug = 'blog-posts';
const entryUuid = 'a1b2c3d4-e5f6-7890-1234-567890abcdef';
 
// Soft delete (default)
axios.delete(`https://your-domain.com/api/${collectionSlug}/${entryUuid}`, {
    headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer YOUR_API_TOKEN', // Required - must have 'delete' ability
        'project-id': 'YOUR_PROJECT_UUID'
    }
});
 
// Permanently delete
axios.delete(`https://your-domain.com/api/${collectionSlug}/${entryUuid}?force=true`, {
    headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer YOUR_API_TOKEN', // Required - must have 'delete' ability
        'project-id': 'YOUR_PROJECT_UUID'
    }
});
use Illuminate\Support\Facades\Http;
 
$response = Http::withToken('YOUR_API_TOKEN')->withHeaders([
    'Accept' => 'application/json',
    'project-id' => 'YOUR_PROJECT_UUID'
])->delete("https://your-domain.com/api/blog-posts/a1b2c3d4...");
import React from 'react';
 
function DeleteButton({ collectionSlug, entryUuid }) {
  const handleDelete = async () => {
    if (!window.confirm("Are you sure you want to delete this entry?")) return;
 
    try {
      const response = await fetch(`https://your-domain.com/api/${collectionSlug}/${entryUuid}`, {
        method: 'DELETE',
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer YOUR_API_TOKEN', // Required - must have 'delete' ability
          'project-id': 'YOUR_PROJECT_UUID'
        }
      });
 
      if (!response.ok) {
        const errorData = await response.json();
        throw new Error(errorData.message || 'Delete failed');
      }
      console.log('Entry deleted successfully');
      // Redirect or update UI state
    } catch (error) {
      console.error('Failed to delete entry:', error);
    }
  };
 
  return <button onClick={handleDelete}>Delete Entry</button>;
}
<template>
  <button @click="deleteEntry">Delete Entry</button>
</template>
 
<script setup>
import { defineProps } from 'vue';
 
const props = defineProps({
  collectionSlug: { type: String, required: true },
  entryUuid: { type: String, required: true }
});
 
const deleteEntry = async () => {
  if (!window.confirm("Are you sure you want to delete this entry?")) return;
 
  try {
    const response = await fetch(`https://your-domain.com/api/${props.collectionSlug}/${props.entryUuid}`, {
      method: 'DELETE',
      headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer YOUR_API_TOKEN', // Required - must have 'delete' ability
        'project-id': 'YOUR_PROJECT_UUID'
      }
    });
 
    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(errorData.message || 'Delete failed');
    }
    console.log('Entry deleted successfully');
    // Redirect or update UI state
  } catch (error) {
    console.error('Failed to delete entry:', error);
  }
};
</script>
curl -X DELETE "https://your-domain.com/api/blog-posts/a1b2c3d4..." \
     -H "Accept: application/json" \
     -H "Authorization: Bearer YOUR_API_TOKEN" \
     -H "project-id: YOUR_PROJECT_UUID"

Responses

200: OK

Returns a confirmation message.

{
    "message": "Content deleted."
}

403: Forbidden

Returned if the API token does not have the delete ability.

{
    "message": "API token doesn't have the right abilities!"
}

404: Not Found

Returned if the collection or the entry does not exist.

{
    "message": "Content not found."
}

Search documentation

Find guides and reference pages