Skip to main content
DELETE
/
api
/
horses
/
:id
Delete Horse
curl --request DELETE \
  --url https://api.example.com/api/horses/:id
{
  "success": true,
  "message": "Horse listing deleted"
}

Authentication

Required - JWT Bearer token
Authorization: Bearer YOUR_JWT_TOKEN

Authorization

  • Sellers can only delete their own listings
  • Admins can delete any listing

Path Parameters

id
string
required
Horse unique identifier (MongoDB ObjectId)

Behavior

  • Permanently deletes the horse listing
  • Automatically deletes all associated vet records
  • Cannot be undone

Response

success
boolean
Indicates if the request was successful
message
string
Confirmation message

Examples

curl -X DELETE "https://api.horsetrust.com/api/horses/507f1f77bcf86cd799439011" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
  "success": true,
  "message": "Horse listing deleted"
}

Error Responses

400 - Invalid Horse ID

{
  "success": false,
  "message": "Invalid horse ID"
}

401 - Unauthorized

{
  "success": false,
  "message": "Authentication required"
}

404 - Not Found or Unauthorized

Returned when:
  • Horse ID doesn’t exist
  • User is not the owner and not an admin
{
  "success": false,
  "message": "Horse not found or unauthorized"
}

500 - Server Error

{
  "success": false,
  "message": "Server error"
}

Notes

This operation is permanent and cannot be undone. All associated vet records will also be deleted.
  • Sellers can only delete horses they own
  • Admins can delete any horse listing
  • Associated vet records are automatically removed
  • Consider setting status: "paused" instead of deleting if you want to temporarily hide a listing

Build docs developers (and LLMs) love