Crear contexto de implementación
Busca en Mintlify Index y devuelve contenido con fuentes citadas reunido dentro de un presupuesto de tokens. Usa este endpoint cuando una aplicación o agente necesite contexto listo para usar en una sola solicitud.
curl --request POST \
--url https://leaves.mintlify.com/api/universal-search/v1/context \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "¿Cómo debo configurar el almacenamiento en caché en Next.js 16?",
"product": "Next.js",
"format": "txt",
"tokenBudget": 3000
}
'import requests
url = "https://leaves.mintlify.com/api/universal-search/v1/context"
payload = {
"query": "¿Cómo debo configurar el almacenamiento en caché en Next.js 16?",
"product": "Next.js",
"format": "txt",
"tokenBudget": 3000
}
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: '¿Cómo debo configurar el almacenamiento en caché en Next.js 16?',
product: 'Next.js',
format: 'txt',
tokenBudget: 3000
})
};
fetch('https://leaves.mintlify.com/api/universal-search/v1/context', 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/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '¿Cómo debo configurar el almacenamiento en caché en Next.js 16?',
'product' => 'Next.js',
'format' => 'txt',
'tokenBudget' => 3000
]),
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/context"
payload := strings.NewReader("{\n \"query\": \"¿Cómo debo configurar el almacenamiento en caché en Next.js 16?\",\n \"product\": \"Next.js\",\n \"format\": \"txt\",\n \"tokenBudget\": 3000\n}")
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/context")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"¿Cómo debo configurar el almacenamiento en caché en Next.js 16?\",\n \"product\": \"Next.js\",\n \"format\": \"txt\",\n \"tokenBudget\": 3000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leaves.mintlify.com/api/universal-search/v1/context")
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 = "{\n \"query\": \"¿Cómo debo configurar el almacenamiento en caché en Next.js 16?\",\n \"product\": \"Next.js\",\n \"format\": \"txt\",\n \"tokenBudget\": 3000\n}"
response = http.request(request)
puts response.read_body{
"requestId": "7f2ab8d1-3bea-4a29-bc51-c05a8d3a3e3c",
"query": "¿Cómo debo configurar el almacenamiento en caché en Next.js 16?",
"response": "### Almacenamiento en caché y revalidación\n\nFuente: https://nextjs.org/docs/app/getting-started/caching-and-revalidating\n\nUsa las API de almacenamiento en caché actuales descritas en esta guía.\n\n--------------------------------",
"resultsCount": 3,
"outputTokens": 1842
}{
"error": "Cuerpo de solicitud no válido"
}{
"error": "No autorizado"
}{
"error": "La dirección IP no está permitida para esta clave de API"
}{
"error": "Límite de uso superado. Vuelve a intentarlo más tarde"
}{
"error": "<string>"
}Autorizaciones
Clave de API de Mintlify Index con el prefijo mint_us_.
Cuerpo
Pregunta de implementación que se investigará.
1Formato de la cadena response. txt devuelve secciones Markdown. json devuelve un objeto JSON serializado que contiene elementos de resultados.
txt, json Nombre del producto o empresa que se usará como indicio adicional de recuperación.
1Dominios que se incluirán en la recuperación.
11Dominios que se excluirán de la recuperación.
11Número máximo de tokens de salida.
1 <= x <= 6000Respuesta
El contexto se creó correctamente.
Identificador único de la solicitud.
Consulta original de la solicitud.
Contenido de fuentes reunido. El valor es Markdown para solicitudes txt y JSON serializado para solicitudes json. La cadena puede estar vacía cuando ningún contenido cabe en el presupuesto de tokens.
Número de fragmentos de fuentes incluidos en la respuesta.
x >= 0Número de tokens de la respuesta reunida.
x >= 0curl --request POST \
--url https://leaves.mintlify.com/api/universal-search/v1/context \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "¿Cómo debo configurar el almacenamiento en caché en Next.js 16?",
"product": "Next.js",
"format": "txt",
"tokenBudget": 3000
}
'import requests
url = "https://leaves.mintlify.com/api/universal-search/v1/context"
payload = {
"query": "¿Cómo debo configurar el almacenamiento en caché en Next.js 16?",
"product": "Next.js",
"format": "txt",
"tokenBudget": 3000
}
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: '¿Cómo debo configurar el almacenamiento en caché en Next.js 16?',
product: 'Next.js',
format: 'txt',
tokenBudget: 3000
})
};
fetch('https://leaves.mintlify.com/api/universal-search/v1/context', 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/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '¿Cómo debo configurar el almacenamiento en caché en Next.js 16?',
'product' => 'Next.js',
'format' => 'txt',
'tokenBudget' => 3000
]),
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/context"
payload := strings.NewReader("{\n \"query\": \"¿Cómo debo configurar el almacenamiento en caché en Next.js 16?\",\n \"product\": \"Next.js\",\n \"format\": \"txt\",\n \"tokenBudget\": 3000\n}")
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/context")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"¿Cómo debo configurar el almacenamiento en caché en Next.js 16?\",\n \"product\": \"Next.js\",\n \"format\": \"txt\",\n \"tokenBudget\": 3000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leaves.mintlify.com/api/universal-search/v1/context")
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 = "{\n \"query\": \"¿Cómo debo configurar el almacenamiento en caché en Next.js 16?\",\n \"product\": \"Next.js\",\n \"format\": \"txt\",\n \"tokenBudget\": 3000\n}"
response = http.request(request)
puts response.read_body{
"requestId": "7f2ab8d1-3bea-4a29-bc51-c05a8d3a3e3c",
"query": "¿Cómo debo configurar el almacenamiento en caché en Next.js 16?",
"response": "### Almacenamiento en caché y revalidación\n\nFuente: https://nextjs.org/docs/app/getting-started/caching-and-revalidating\n\nUsa las API de almacenamiento en caché actuales descritas en esta guía.\n\n--------------------------------",
"resultsCount": 3,
"outputTokens": 1842
}{
"error": "Cuerpo de solicitud no válido"
}{
"error": "No autorizado"
}{
"error": "La dirección IP no está permitida para esta clave de API"
}{
"error": "Límite de uso superado. Vuelve a intentarlo más tarde"
}{
"error": "<string>"
}