Favorites let users bookmark places, events, or cities for quick access. The favorites system uses a polymorphic morph relation (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/astrxnomo/tourify/llms.txt
Use this file to discover all available pages before exploring further.
favorable) so all three resource types share a single endpoint. All favorites endpoints require authentication.
GET /api/favorites
Returns all items the authenticated user has saved as favorites. Each favorite includes the full favorited item (place, event, or city) with its images loaded.This endpoint requires authentication. Include your bearer token in the
Authorization header.auth:sanctum).
Response Fields
Returns a JSON array of favorite objects.Unique identifier of the favorite record.
The type of the favorited item. One of:
place, event, city.The ID of the favorited item within its type.
The full favorited resource (place, event, or city) with its
images array eagerly loaded.Timestamp when the favorite was saved.
Example request
POST /api/favorites
Saves an item as a favorite for the authenticated user. The operation is idempotent — if the user has already favorited the same item, the existing favorite is returned without creating a duplicate. Returns HTTP 201 in both cases.This endpoint requires authentication. Include your bearer token in the
Authorization header.auth:sanctum).
Request Body
The ID of the item to favorite (e.g., the place ID, event ID, or city ID).
The type of item to favorite. Must be one of:
place, event, city.Response Fields
Unique identifier of the favorite record.
ID of the user who owns this favorite.
ID of the favorited item.
Type string of the favorited item. One of:
place, event, city.Timestamp when the favorite was created.
Timestamp when the favorite record was last updated.
Example request
DELETE /api/favorites/
Deletes a specific favorite by its record ID. Returns HTTP 403 if the favorite belongs to a different user than the one making the request.This endpoint requires authentication. Include your bearer token in the
Authorization header.auth:sanctum).
Path Parameters
The ID of the favorite record to delete.
Response Fields
A confirmation message. Value:
"Favorito eliminado."Example request
DELETE /api/favorites
Deletes a favorite by morph type and morph ID, scoped to the authenticated user. Use this endpoint when you know the item type and ID but not the favorite record’s own ID. No separate ownership check is needed — the query is automatically scoped to the current user.This endpoint requires authentication. Include your bearer token in the
Authorization header.auth:sanctum).
Request Body
The ID of the favorited item to remove (e.g., the place ID, event ID, or city ID).
The type of the favorited item. Must be one of:
place, event, city.Response Fields
A confirmation message. Value:
"Favorito eliminado."This endpoint silently succeeds even if no matching favorite exists for the current user — it will not return a 404.
Example request