Delete Prompt
curl --request DELETE \
--url https://api.example.com/api/admin/prompts/:idimport requests
url = "https://api.example.com/api/admin/prompts/:id"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.example.com/api/admin/prompts/:id', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/admin/prompts/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/admin/prompts/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/api/admin/prompts/:id")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/admin/prompts/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body{
"401": {},
"403": {},
"404": {}
}Prompts
Delete Prompt
DELETE
/
api
/
admin
/
prompts
/
:id
Delete Prompt
curl --request DELETE \
--url https://api.example.com/api/admin/prompts/:idimport requests
url = "https://api.example.com/api/admin/prompts/:id"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.example.com/api/admin/prompts/:id', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/admin/prompts/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/admin/prompts/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/api/admin/prompts/:id")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/admin/prompts/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body{
"401": {},
"403": {},
"404": {}
}Deletes a prompt and all its version history. If a specific version number is provided, only that version snapshot is deleted.
Benefits:
Authentication
Requires JWT Bearer token (Cognito) with admin role.Path Parameters
string
required
Prompt UUID to deleteFormat: UUIDExample:
550e8400-e29b-41d4-a716-446655440000Query Parameters
number
If provided, deletes only this specific version snapshot rather than the entire promptExample:
2Useful for cleaning up old version history without removing the prompt itself.Response
Status:204 No Content
No response body is returned on successful deletion.
Example Request (Delete Entire Prompt)
curl -X DELETE https://api.example.com/api/admin/prompts/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Example Request (Delete Specific Version)
curl -X DELETE "https://api.example.com/api/admin/prompts/550e8400-e29b-41d4-a716-446655440000?version=2" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Error Responses
error
Missing or invalid Bearer token
error
Forbidden — admin role required
error
Prompt or version not found
Cascade Behavior
When deleting an entire prompt (noversion parameter):
- The prompt record is deleted from the
promptstable - All version snapshots in
prompt_versionsare deleted (CASCADE) - All comments in
prompt_commentsare deleted (CASCADE) - All change records in
prompt_changesare deleted (CASCADE)
version parameter):
- Only the specified version snapshot is removed from
prompt_versions - The prompt itself and other versions remain intact
- A change record is created with type
DELETE
Deletion Tracking
When a prompt is deleted:- A final change record is created in
prompt_changeswith:changeType: DELETEauthorId: User who deleted the promptcreatedAt: Deletion timestamp
- The change record persists even after the prompt is deleted (foreign key allows NULL)
Soft Delete Alternative
Consider using theisActive flag as a soft delete:
# Instead of deleting, deactivate the prompt
curl -X PUT https://api.example.com/api/admin/prompts/550e8400-e29b-41d4-a716-446655440000/update \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "isActive": false }'
- Preserves full history and comments
- Can be reactivated later
- Allows filtering out inactive prompts in the UI
Source Code
Implementation:packages/api/src/prompts/prompts.controller.ts:179⌘I