Skip to main content
POST
/
api
/
horses
Create Horse
curl --request POST \
  --url https://api.example.com/api/horses \
  --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>"
    }
  ]
}
'
{
  "success": true,
  "message": "Horse listing created",
  "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": "San Isidro",
      "coordinates": {
        "lat": -34.4708,
        "lng": -58.5247
      }
    },
    "price": 45000,
    "currency": "USD",
    "photos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j1",
        "url": "https://cdn.horsetrust.com/photos/abc123.jpg",
        "caption": "Thunder at competition",
        "is_cover": true,
        "uploaded_at": "2026-03-05T10:00:00Z"
      },
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j2",
        "url": "https://cdn.horsetrust.com/photos/abc124.jpg",
        "caption": "Side view",
        "is_cover": false,
        "uploaded_at": "2026-03-05T10:00:00Z"
      },
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j3",
        "url": "https://cdn.horsetrust.com/photos/abc125.jpg",
        "caption": "Training session",
        "is_cover": false,
        "uploaded_at": "2026-03-05T10:00:00Z"
      }
    ],
    "videos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j4",
        "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-05T10:00:00Z"
      }
    ],
    "status": "draft",
    "views_count": 0,
    "created_at": "2026-03-05T10:00:00Z",
    "updated_at": "2026-03-05T10:00:00Z"
  }
}

Authentication

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

Request Body

name
string
required
Horse name (trimmed)
age
number
required
Horse age in years (0-40)
breed
string
required
Horse breed (trimmed)
discipline
string
required
Primary discipline (trimmed)
pedigree
string
Pedigree information
location
object
required
Horse location information
country
string
required
Country
region
string
required
Region or state
city
string
City
coordinates
object
GPS coordinates
lat
number
Latitude
lng
number
Longitude
price
number
Listing price (minimum: 0)
currency
string
default:"USD"
Currency code: USD, EUR, ARS, BRL, MXN
photos
array
required
Array of photos (minimum 3 required)
url
string
required
Photo URL
caption
string
Photo caption
is_cover
boolean
default:false
Whether this is the cover photo
videos
array
Array of videos (optional)
url
string
required
Video URL (YouTube or Vimeo URLs will auto-generate embed_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)

Response

success
boolean
Indicates if the request was successful
message
string
Success message
data
object
Created horse listing
_id
string
Horse unique identifier
seller_id
string
Seller ID (automatically set from authenticated user)
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 with generated IDs and timestamps
videos
array
Array of videos with auto-generated embed_url for YouTube/Vimeo
status
string
Initial status (always “draft”)
views_count
number
Initial view count (always 0)
created_at
string
Creation timestamp
updated_at
string
Last update timestamp

Notes

  • New listings are created with status: "draft" by default
  • seller_id is automatically set from the authenticated user
  • views_count is initialized to 0
  • Video embed_url is auto-generated for YouTube and Vimeo URLs
  • Photos must include at least 3 items (validated)
  • Full-text search index includes name, breed, discipline, and pedigree

Examples

curl -X POST "https://api.horsetrust.com/api/horses" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "name": "Thunder",
    "age": 8,
    "breed": "Thoroughbred",
    "discipline": "Show Jumping",
    "pedigree": "Sire: Storm Cat, Dam: Winning Colors",
    "location": {
      "country": "Argentina",
      "region": "Buenos Aires",
      "city": "San Isidro",
      "coordinates": {
        "lat": -34.4708,
        "lng": -58.5247
      }
    },
    "price": 45000,
    "currency": "USD",
    "photos": [
      {
        "url": "https://cdn.horsetrust.com/photos/abc123.jpg",
        "caption": "Thunder at competition",
        "is_cover": true
      },
      {
        "url": "https://cdn.horsetrust.com/photos/abc124.jpg",
        "caption": "Side view"
      },
      {
        "url": "https://cdn.horsetrust.com/photos/abc125.jpg",
        "caption": "Training session"
      }
    ],
    "videos": [
      {
        "url": "https://youtube.com/watch?v=abc123",
        "video_type": "competition",
        "title": "Thunder jumping 1.40m",
        "recorded_at": "2026-02-15T00:00:00Z"
      }
    ]
  }'
{
  "success": true,
  "message": "Horse listing created",
  "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": "San Isidro",
      "coordinates": {
        "lat": -34.4708,
        "lng": -58.5247
      }
    },
    "price": 45000,
    "currency": "USD",
    "photos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j1",
        "url": "https://cdn.horsetrust.com/photos/abc123.jpg",
        "caption": "Thunder at competition",
        "is_cover": true,
        "uploaded_at": "2026-03-05T10:00:00Z"
      },
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j2",
        "url": "https://cdn.horsetrust.com/photos/abc124.jpg",
        "caption": "Side view",
        "is_cover": false,
        "uploaded_at": "2026-03-05T10:00:00Z"
      },
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j3",
        "url": "https://cdn.horsetrust.com/photos/abc125.jpg",
        "caption": "Training session",
        "is_cover": false,
        "uploaded_at": "2026-03-05T10:00:00Z"
      }
    ],
    "videos": [
      {
        "_id": "65f1a2b3c4d5e6f7g8h9i0j4",
        "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-05T10:00:00Z"
      }
    ],
    "status": "draft",
    "views_count": 0,
    "created_at": "2026-03-05T10:00:00Z",
    "updated_at": "2026-03-05T10:00:00Z"
  }
}

Error Responses

400 - Validation Error

{
  "success": false,
  "message": "Horse validation failed: name: Horse name is required, photos: At least 3 photos are required"
}

401 - Unauthorized

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

403 - Forbidden

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

500 - Server Error

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

Build docs developers (and LLMs) love