Skip to main content
POST
/
api
/
routes
/
:routeId
/
favorites
Add Route to Favorites
curl --request POST \
  --url https://api.example.com/api/routes/:routeId/favorites
{
  "success": true,
  "message": "<string>",
  "data": {
    "id": "<string>",
    "userId": "<string>",
    "routeId": "<string>",
    "createdAt": "<string>",
    "route": {
      "id": "<string>",
      "name": "<string>",
      "slug": "<string>",
      "image": "<string>",
      "approximateDistance": "<string>",
      "level": [
        {}
      ]
    }
  }
}
Add a route to the authenticated user’s favorites. Users can favorite multiple routes, but cannot add the same route twice.

Authentication

This endpoint requires authentication. Include a valid Bearer token in the Authorization header.

Path Parameters

routeId
string
required
UUID of the route to add to favoritesExample: 987e6543-e21b-12d3-a456-426614174000

Response

success
boolean
required
Indicates if the request was successful
message
string
required
Success message confirming the route was added to favorites
data
object
required
The created favorite object with route details

Example Request

curl -X POST https://api.losinmaduros.com/api/routes/987e6543-e21b-12d3-a456-426614174000/favorites \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Example Response

{
  "success": true,
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "userId": "user_2abc123def456",
    "routeId": "987e6543-e21b-12d3-a456-426614174000",
    "createdAt": "2026-03-04T14:30:00Z",
    "route": {
      "id": "987e6543-e21b-12d3-a456-426614174000",
      "name": "Casa de Campo",
      "slug": "casa-de-campo",
      "image": "https://example.com/routes/casa-de-campo.jpg",
      "approximateDistance": "15 km",
      "level": ["INTERMEDIATE"]
    }
  },
  "message": "Route added to favorites successfully"
}

Error Responses

401 Unauthorized
Invalid or missing authentication token
{
  "success": false,
  "error": "Unauthorized"
}
404 Not Found
The specified route does not exist
{
  "success": false,
  "error": "Route not found"
}
409 Conflict
The route is already in the user’s favorites
{
  "success": false,
  "error": "Route is already in your favorites"
}

Build docs developers (and LLMs) love