Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/mohameodo/nano/llms.txt

Use this file to discover all available pages before exploring further.

/api/search queries the TMDB API for both movies and TV shows simultaneously, merges the results, and sorts them by popularity. It is the backbone of nano’s search bar and can be called directly to build custom search experiences against your nano instance.

Request

Method: GET
Path: /api/search
q
string
required
The search query string. If empty or omitted, the endpoint returns { results: [], total_pages: 1 } immediately without calling TMDB.
page
string
default:"1"
Page number for paginated results. Passed directly to TMDB’s search API.
lang
string
TMDB language code for localized results (e.g. en, fr, es, de). When omitted, TMDB returns its default language.

Response

Content-Type: application/json
results
array
Array of result objects. Movies and TV shows are mixed together and sorted by popularity descending.
total_pages
number
Total number of result pages available from TMDB. Use the page parameter to paginate through them. When the fallback list is returned, this is always 1.

Example

curl "http://localhost:3000/api/search?q=inception&lang=en"
{
  "results": [
    {
      "id": 27205,
      "title": "Inception",
      "poster_path": "/oYu2Qhx0qbSgLN7IQalj27YchgY.jpg",
      "media_type": "movie",
      "release_date": "2010-07-15",
      "popularity": 87.3,
      "overview": "Cobb, a skilled thief who commits corporate espionage..."
    },
    {
      "id": 1408,
      "title": "Inception: The Cobol Job",
      "poster_path": "/rXJPRQ2J9rlmDU7ygRYfzBOhHsP.jpg",
      "media_type": "movie",
      "release_date": "2010-12-07",
      "popularity": 12.1
    }
  ],
  "total_pages": 1
}

Fallback Behavior

If TMDB returns no results (e.g. an unusual query with zero hits) or if the TMDB request fails entirely, /api/search falls back to a built-in static list of popular titles and filters it by the search query string. The fallback list contains:
TitleTMDB IDType
Inception27205movie
Interstellar157336movie
The Dark Knight155movie
Breaking Bad1396tv
Stranger Things66732tv
Wednesday119051tv
Squid Game93405tv
Fallback responses always have total_pages: 1.
Submitting an empty q parameter (e.g. /api/search?q=) returns { "results": [], "total_pages": 1 } immediately. The TMDB API is never called in this case, so there is no latency cost.

Build docs developers (and LLMs) love