Build implementation context
POST
/
v1
/
context
Build implementation context
curl --request POST \
--url https://leaves.mintlify.com/api/universal-search/v1/context \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "How should I configure caching in Next.js 16?",
"product": "Next.js",
"format": "txt",
"tokenBudget": 3000
}
'{
"requestId": "7f2ab8d1-3bea-4a29-bc51-c05a8d3a3e3c",
"query": "How should I configure caching in Next.js 16?",
"response": "### Caching and revalidating\n\nSource: https://nextjs.org/docs/app/getting-started/caching-and-revalidating\n\nUse the current caching APIs described in this guide.\n\n--------------------------------",
"resultsCount": 3,
"outputTokens": 1842
}{
"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”Authorization
string
header
required
Mintlify Index API key with the mint_us_ prefix.
application/json
query
string
required
Implementation question to research.
Minimum string length: 1
format
enum<string>
required
Format of the response string. txt returns Markdown sections. json returns a serialized JSON object containing result items.
Available options:
txt,
json
product
string
Product or company name to use as an additional retrieval hint.
Minimum string length: 1
includeDomains
string[]
Domains to include in retrieval.
Minimum array length: 1
Minimum string length: 1
excludeDomains
string[]
Domains to exclude from retrieval.
Minimum array length: 1
Minimum string length: 1
tokenBudget
integer
default:3000
Maximum number of output tokens.
Required range: 1 <= x <= 6000
Response
Section titled “Response”Context assembled successfully.
requestId
string
required
Unique identifier for the request.
query
string
required
Original query from the request.
response
string
required
Assembled source content. The value is Markdown for txt requests and serialized JSON for json requests. The string can be empty when no content fits within the token budget.
resultsCount
integer
required
Number of source snippets included in the response.
Required range: x >= 0
outputTokens
integer
required
Number of tokens in the assembled response.
Required range: x >= 0
⌘I