Skip to main content

Endpoint

GET /api/favorites/check/:routeId

Authentication

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

Path Parameters

routeId
string
required
The unique identifier (UUID) of the route to check

Response

success
boolean
Indicates if the request was successful
data
object
Check result object

Example Request

cURL
curl https://api.example.com/api/favorites/check/987e6543-e21b-12d3-a456-426614174000 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

{
  "success": true,
  "data": {
    "isFavorite": true,
    "favoriteId": "fav_abc123"
  }
}

Use Cases

  • Display a “favorited” UI state (heart icon, bookmark, etc.)
  • Toggle favorite status in the frontend
  • Filter lists to show only non-favorited routes

Example Usage

// Check if route is favorited
const response = await fetch(
  `https://api.example.com/api/favorites/check/${routeId}`,
  {
    headers: {
      'Authorization': `Bearer ${token}`
    }
  }
);

const { data } = await response.json();

if (data.isFavorite) {
  // Show filled heart icon
  // Can use data.favoriteId to remove it later
} else {
  // Show outline heart icon
}

Add Favorite

Add a route to favorites

Remove Favorite

Remove a route from favorites

Build docs developers (and LLMs) love