Skip to main content
PUT
/
api
/
horses
/
:id
Update Horse
curl --request PUT \
  --url https://api.example.com/api/horses/:id \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "age": 123,
  "breed": "<string>",
  "discipline": "<string>",
  "pedigree": "<string>",
  "location": {
    "country": "<string>",
    "region": "<string>",
    "city": "<string>",
    "coordinates": {
      "lat": 123,
      "lng": 123
    }
  },
  "price": 123,
  "currency": "<string>",
  "photos": [
    {
      "url": "<string>",
      "caption": "<string>",
      "is_cover": true
    }
  ],
  "videos": [
    {
      "url": "<string>",
      "video_type": "<string>",
      "title": "<string>",
      "description": "<string>",
      "recorded_at": "<string>"
    }
  ],
  "status": "<string>"
}
'
{
  "success": true,
  "data": {
    "_id": "507f1f77bcf86cd799439011",
    "seller_id": "507f191e810c19729de860ea",
    "name": "Thunder",
    "age": 8,
    "breed": "Thoroughbred",
    "discipline": "Show Jumping",
    "pedigree": "Sire: Storm Cat, Dam: Winning Colors",
    "location": {
      "country": "Argentina",
      "region": "Buenos Aires",
      "city": "Pilar",
      "coordinates": {
        "lat": -34.4708,
        "lng": -58.5247
      }
    },
    "price": 42000,
    "currency": "USD",
    "photos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j1",
        "url": "https://cdn.horsetrust.com/photos/abc123.jpg",
        "caption": "Thunder at competition",
        "is_cover": true,
        "uploaded_at": "2026-03-01T10:00:00Z"
      }
    ],
    "videos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j2",
        "url": "https://youtube.com/watch?v=abc123",
        "embed_url": "https://www.youtube.com/embed/abc123",
        "video_type": "competition",
        "title": "Thunder jumping 1.40m",
        "recorded_at": "2026-02-15T00:00:00Z",
        "uploaded_at": "2026-03-01T10:00:00Z"
      }
    ],
    "status": "active",
    "views_count": 235,
    "created_at": "2026-03-01T10:00:00Z",
    "updated_at": "2026-03-05T15:45:00Z"
  }
}

Authentication

Required - JWT Bearer token with seller or admin role
Authorization: Bearer YOUR_JWT_TOKEN

Authorization

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

Path Parameters

id
string
required
Horse unique identifier (MongoDB ObjectId)

Request Body

All fields are optional - only include fields you want to update.
name
string
Horse name (trimmed)
age
number
Horse age in years (0-40)
breed
string
Horse breed (trimmed)
discipline
string
Primary discipline (trimmed)
pedigree
string
Pedigree information
location
object
Horse location information
country
string
Country
region
string
Region or state
city
string
City
coordinates
object
lat
number
Latitude
lng
number
Longitude
price
number
Listing price (minimum: 0)
currency
string
Currency code: USD, EUR, ARS, BRL, MXN
photos
array
Array of photos (minimum 3 required if updating)
url
string
required
Photo URL
caption
string
Photo caption
is_cover
boolean
Whether this is the cover photo
videos
array
Array of videos
url
string
required
Video URL
video_type
string
required
Type: training, competition, other
title
string
Video title
description
string
Video description
recorded_at
string
required
Recording date (ISO 8601)
status
string
Listing status: active, sold, paused, draft

Response

success
boolean
Indicates if the request was successful
data
object
Updated horse listing with all fields
_id
string
Horse unique identifier
seller_id
string
Seller ID
name
string
Horse name
age
number
Horse age
breed
string
Horse breed
discipline
string
Primary discipline
pedigree
string
Pedigree information
location
object
Location details
price
number
Listing price
currency
string
Currency code
photos
array
Array of photos
videos
array
Array of videos with auto-generated embed_url
status
string
Listing status
views_count
number
View count
created_at
string
Creation timestamp
updated_at
string
Last update timestamp (updated)

Notes

  • Only provide fields you want to update (partial update)
  • Validators run on update, ensuring data integrity
  • Video embed_url is auto-regenerated for YouTube/Vimeo URLs
  • updated_at timestamp is automatically updated
  • Cannot change seller_id or views_count via this endpoint

Examples

curl -X PUT "https://api.horsetrust.com/api/horses/507f1f77bcf86cd799439011" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "price": 42000,
    "status": "active",
    "location": {
      "country": "Argentina",
      "region": "Buenos Aires",
      "city": "Pilar"
    }
  }'
{
  "success": true,
  "data": {
    "_id": "507f1f77bcf86cd799439011",
    "seller_id": "507f191e810c19729de860ea",
    "name": "Thunder",
    "age": 8,
    "breed": "Thoroughbred",
    "discipline": "Show Jumping",
    "pedigree": "Sire: Storm Cat, Dam: Winning Colors",
    "location": {
      "country": "Argentina",
      "region": "Buenos Aires",
      "city": "Pilar",
      "coordinates": {
        "lat": -34.4708,
        "lng": -58.5247
      }
    },
    "price": 42000,
    "currency": "USD",
    "photos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j1",
        "url": "https://cdn.horsetrust.com/photos/abc123.jpg",
        "caption": "Thunder at competition",
        "is_cover": true,
        "uploaded_at": "2026-03-01T10:00:00Z"
      }
    ],
    "videos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j2",
        "url": "https://youtube.com/watch?v=abc123",
        "embed_url": "https://www.youtube.com/embed/abc123",
        "video_type": "competition",
        "title": "Thunder jumping 1.40m",
        "recorded_at": "2026-02-15T00:00:00Z",
        "uploaded_at": "2026-03-01T10:00:00Z"
      }
    ],
    "status": "active",
    "views_count": 235,
    "created_at": "2026-03-01T10:00:00Z",
    "updated_at": "2026-03-05T15:45:00Z"
  }
}

Error Responses

400 - Invalid Horse ID

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

400 - Validation Error

{
  "success": false,
  "message": "Validation failed: age: Path `age` (50) is more than maximum (40)"
}

401 - Unauthorized

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

403 - Forbidden

{
  "success": false,
  "message": "Seller role required"
}

404 - Not Found or Unauthorized

{
  "success": false,
  "message": "Horse not found or unauthorized"
}

500 - Server Error

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

Build docs developers (and LLMs) love