Skip to main content

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.

Favorites let users bookmark places, events, or cities for quick access. The favorites system uses a polymorphic morph relation (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.
Authentication: Required (auth:sanctum).

Response Fields

Returns a JSON array of favorite objects.
id
integer
Unique identifier of the favorite record.
favorable_type
string
The type of the favorited item. One of: place, event, city.
favorable_id
integer
The ID of the favorited item within its type.
favorable
object
The full favorited resource (place, event, or city) with its images array eagerly loaded.
created_at
string (ISO 8601)
Timestamp when the favorite was saved.
Example request
curl http://localhost:8000/api/favorites \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {your-token}"

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.
Authentication: Required (auth:sanctum).

Request Body

favorable_id
integer
required
The ID of the item to favorite (e.g., the place ID, event ID, or city ID).
favorable_type
string
required
The type of item to favorite. Must be one of: place, event, city.

Response Fields

id
integer
Unique identifier of the favorite record.
user_id
integer
ID of the user who owns this favorite.
favorable_id
integer
ID of the favorited item.
favorable_type
string
Type string of the favorited item. One of: place, event, city.
created_at
string (ISO 8601)
Timestamp when the favorite was created.
updated_at
string (ISO 8601)
Timestamp when the favorite record was last updated.
Example request
curl -X POST http://localhost:8000/api/favorites \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {your-token}" \
  -H "Content-Type: application/json" \
  -d '{"favorable_id": 7, "favorable_type": "event"}'

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.
Authentication: Required (auth:sanctum).

Path Parameters

favorite
integer
required
The ID of the favorite record to delete.

Response Fields

message
string
A confirmation message. Value: "Favorito eliminado."
Returns HTTP 403 with {"message": "No autorizado."} if the favorite record is owned by a different user.
Example request
curl -X DELETE http://localhost:8000/api/favorites/42 \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {your-token}"

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.
Authentication: Required (auth:sanctum).

Request Body

favorable_id
integer
required
The ID of the favorited item to remove (e.g., the place ID, event ID, or city ID).
favorable_type
string
required
The type of the favorited item. Must be one of: place, event, city.

Response Fields

message
string
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
curl -X DELETE http://localhost:8000/api/favorites \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {your-token}" \
  -H "Content-Type: application/json" \
  -d '{"favorable_id": 7, "favorable_type": "event"}'

Build docs developers (and LLMs) love