Search technical knowledge
Returns ranked results from publisher-maintained documentation or the web. Use Mintlify result IDs or any result URL with the contents endpoint when you need more content.
Related topics
POST /v1/search
curl --request POST \
--url https://leaves.mintlify.com/api/universal-search/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"query": "Next.js 16 caching and revalidation",
"numResults": 5,
"text": {
"maxCharacters": 4000
},
"includeDomains": [
"nextjs.org"
]
}'import requests
url = "https://leaves.mintlify.com/api/universal-search/v1/search"
payload = {
"query": "Next.js 16 caching and revalidation",
"numResults": 5,
"text": {
"maxCharacters": 4000
},
"includeDomains": [
"nextjs.org"
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {method: "POST", headers: {"Authorization": "Bearer <token>", "Content-Type": "application/json"}, body: JSON.stringify({
"query": "Next.js 16 caching and revalidation",
"numResults": 5,
"text": {
"maxCharacters": 4000
},
"includeDomains": [
"nextjs.org"
]
})};
fetch("https://leaves.mintlify.com/api/universal-search/v1/search", options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://leaves.mintlify.com/api/universal-search/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"query\":\"Next.js 16 caching and revalidation\",\"numResults\":5,\"text\":{\"maxCharacters\":4000},\"includeDomains\":[\"nextjs.org\"]}",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://leaves.mintlify.com/api/universal-search/v1/search"
payload := strings.NewReader("{\"query\":\"Next.js 16 caching and revalidation\",\"numResults\":5,\"text\":{\"maxCharacters\":4000},\"includeDomains\":[\"nextjs.org\"]}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://leaves.mintlify.com/api/universal-search/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\"query\":\"Next.js 16 caching and revalidation\",\"numResults\":5,\"text\":{\"maxCharacters\":4000},\"includeDomains\":[\"nextjs.org\"]}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leaves.mintlify.com/api/universal-search/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\"query\":\"Next.js 16 caching and revalidation\",\"numResults\":5,\"text\":{\"maxCharacters\":4000},\"includeDomains\":[\"nextjs.org\"]}"
response = http.request(request)
puts response.read_body{
"requestId": "3d8ed0aa-c21c-4a18-b995-207aa6315ea8",
"results": [
{
"id": "nextjs:/docs/app/getting-started/caching-and-revalidating",
"url": "https://nextjs.org/docs/app/getting-started/caching-and-revalidating",
"title": "Caching and revalidating",
"text": "Caching is a technique for storing the result of data fetching and other computations.",
"truncated": false,
"totalCharacters": 92,
"score": 0.91,
"source": "mintlify",
"siteName": "nextjs",
"breadcrumbs": [
"App Router",
"Getting started"
],
"publishedDate": null
}
]
}{
"error": "Invalid request body"
}{
"error": "Unauthorized"
}{
"error": "IP address is not allowed for this API key"
}{
"error": "Rate limit exceeded. Please try again later"
}{
"error": "<string>"
}Authorizations
Section titled “Authorizations”AuthorizationstringrequiredMintlify Index API key with the mint_us_ prefix.
querystringrequiredSearch query.
Required string length: 1+
numResultsintegerrequiredMaximum number of results to return.
Required range: 1 <= x <= 20
text?booleanincludeDomains?string[]Domains to include in search results.
excludeDomains?string[]Domains to exclude from search results.
Response
Section titled “Response”200 — Search completed successfully.
requestIdstringrequiredUnique identifier for the request.
resultsobject[]requiredRanked search results.
Show child attributes
idstringrequiredResult identifier. Pass IDs from Mintlify results in the contents request's ids field. For web results, pass the result URL in urls.
urlstringrequiredCanonical source URL.
titlestringrequiredSource title.
textstringrequiredMatched content when requested. Otherwise, an empty string.
truncated?booleanWhether the returned content is shorter than the available content.
totalCharacters?integerNumber of available characters before truncation. Present when available.
Required range: 0 <= x
scorenumberrequiredRelative relevance score. Contents responses use 0 because they retrieve selected items rather than rank results.
sourceenum<string>requiredRetrieval source.
Available options: mintlify, web
siteNamestringrequiredDocumentation site or web hostname.
breadcrumbsstring[]requiredDocumentation hierarchy for the result.
publishedDatestring | nullrequiredPublished date when the source provides one, otherwise null. search results normalize this to a full ISO 8601 timestamp. contents results retrieved by urls pass the source's original date string through unnormalized, which can be a full timestamp or a date-only string.