Destinations
Ce contenu n’est pas encore disponible dans votre langue.
Overview
Section titled “Overview”The Destinations resource provides fake destination data with names, descriptions, categories, coordinates, and ratings.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/destinations | List all destinations |
| GET | /v1/destinations/:id | Get a specific destination |
Destination Object
Section titled “Destination Object”{ "id": 1, "cityId": 1, "name": "Central Park", "slug": "central-park", "description": "An urban park in Manhattan.", "category": "park", "image": "https://example.com/images/central-park.jpg", "latitude": 40.7828647, "longitude": -73.9653551, "rating": 4.8, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
cityId |
number |
ID of the city |
name |
string |
Destination name |
slug |
string |
URL-friendly unique slug |
description |
string |
Destination description |
category |
string |
Category (e.g. park, museum, monument) |
image |
string |
Destination image URL |
latitude |
number |
Latitude coordinate |
longitude |
number |
Longitude coordinate |
rating |
number |
Average rating (0–5) |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Destinations
Section titled “List Destinations”curl https://api.phantomjson.app/v1/destinationsQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
q |
string |
— | Search query |
fields |
string |
— | Fields to return |
cityId |
number |
— | Filter by city ID |
category |
string |
— | Filter by category |
Response
Section titled “Response”{ "data": [ { "id": 1, "cityId": 1, "name": "Central Park", "slug": "central-park", "category": "park", "rating": 4.8 } ], "meta": { "total": 60, "page": 1, "limit": 20, "totalPages": 3 }}Get Destination by ID
Section titled “Get Destination by ID”curl https://api.phantomjson.app/v1/destinations/1Response
Section titled “Response”{ "data": { "id": 1, "cityId": 1, "name": "Central Park", "slug": "central-park", "description": "An urban park in Manhattan.", "category": "park", "image": "https://example.com/images/central-park.jpg", "latitude": 40.7828647, "longitude": -73.9653551, "rating": 4.8 }}Examples
Section titled “Examples”Search Destinations
Section titled “Search Destinations”curl "https://api.phantomjson.app/v1/destinations?q=park"Filter by City
Section titled “Filter by City”curl "https://api.phantomjson.app/v1/destinations?cityId=1"Filter by Category
Section titled “Filter by Category”curl "https://api.phantomjson.app/v1/destinations?category=museum"Sort by Rating
Section titled “Sort by Rating”# Lowest firstcurl "https://api.phantomjson.app/v1/destinations?sort=rating:asc"
# Highest firstcurl "https://api.phantomjson.app/v1/destinations?sort=rating:desc"Sort by Name
Section titled “Sort by Name”curl "https://api.phantomjson.app/v1/destinations?sort=name:asc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/destinations?fields=id,name,category,rating"Combined Query
Section titled “Combined Query”# Museums in city 1 sorted by ratingcurl "https://api.phantomjson.app/v1/destinations?cityId=1&category=museum&sort=rating:desc"Relations
Section titled “Relations”- City — Each destination belongs to a city (
cityId)
