# Get result contents

**Related topics**

- [Get page content](/guides/assistant-2-get-page-content)
- [Mintlify CLI command reference](/guides/get-started-cli-commands)
- [Quickstart](/guides/get-started-quickstart)

`POST /v1/contents`

:::code-group
```bash title="cURL"
curl --request POST \
  --url https://leaves.mintlify.com/api/universal-search/v1/contents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "ids": [
    "nextjs:/docs/app/getting-started/caching-and-revalidating"
  ],
  "query": "revalidate cached data",
  "maxCharacters": 12000
}'
```

```python title="Python"
import requests

url = "https://leaves.mintlify.com/api/universal-search/v1/contents"

payload = {
  "ids": [
    "nextjs:/docs/app/getting-started/caching-and-revalidating"
  ],
  "query": "revalidate cached data",
  "maxCharacters": 12000
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

```javascript title="JavaScript"
const options = {method: "POST", headers: {"Authorization": "Bearer <token>", "Content-Type": "application/json"}, body: JSON.stringify({
  "ids": [
    "nextjs:/docs/app/getting-started/caching-and-revalidating"
  ],
  "query": "revalidate cached data",
  "maxCharacters": 12000
})};

fetch("https://leaves.mintlify.com/api/universal-search/v1/contents", options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

```php title="PHP"
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://leaves.mintlify.com/api/universal-search/v1/contents",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"ids\":[\"nextjs:/docs/app/getting-started/caching-and-revalidating\"],\"query\":\"revalidate cached data\",\"maxCharacters\":12000}",
  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;
}
```

```go title="Go"
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://leaves.mintlify.com/api/universal-search/v1/contents"

	payload := strings.NewReader("{\"ids\":[\"nextjs:/docs/app/getting-started/caching-and-revalidating\"],\"query\":\"revalidate cached data\",\"maxCharacters\":12000}")

	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))

}
```

```java title="Java"
HttpResponse<String> response = Unirest.post("https://leaves.mintlify.com/api/universal-search/v1/contents")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\"ids\":[\"nextjs:/docs/app/getting-started/caching-and-revalidating\"],\"query\":\"revalidate cached data\",\"maxCharacters\":12000}")
  .asString();
```

```ruby title="Ruby"
require 'uri'
require 'net/http'

url = URI("https://leaves.mintlify.com/api/universal-search/v1/contents")

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 = "{\"ids\":[\"nextjs:/docs/app/getting-started/caching-and-revalidating\"],\"query\":\"revalidate cached data\",\"maxCharacters\":12000}"

response = http.request(request)
puts response.read_body
```
:::

:::code-group
```json title="200"
{
  "requestId": "6bf694e4-76cb-4d31-a222-c94b2d9b198a",
  "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 and revalidating\n\nUse revalidation APIs to refresh cached data.",
      "truncated": false,
      "totalCharacters": 78,
      "score": 0,
      "source": "mintlify",
      "siteName": "nextjs",
      "breadcrumbs": [
        "App Router",
        "Getting started"
      ],
      "publishedDate": null
    }
  ],
  "statuses": [
    {
      "id": "nextjs:/docs/app/getting-started/caching-and-revalidating",
      "status": "success"
    }
  ]
}
```

```json title="400"
{
  "error": "A request may reference at most 20 items across urls and ids"
}
```

```json title="401"
{
  "error": "Unauthorized"
}
```

```json title="403"
{
  "error": "IP address is not allowed for this API key"
}
```

```json title="429"
{
  "error": "Rate limit exceeded. Please try again later"
}
```

```json title="500"
{
  "error": "<string>"
}
```
:::

#### Authorizations

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `Authorization` | `string` | - | Mintlify Index API key with the mint_us_ prefix. |

#### Body

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `urls?` | `string[]` | - | Result URLs to retrieve. Use this field for web results. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `ids?` | `string[]` | - | Mintlify result IDs to retrieve. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `maxCharacters?` | `integer` | - | Maximum number of content characters to return per result. Required range: 1 <= x |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `query?` | `string` | - | Query used to select the most relevant sections when content exceeds maxCharacters. Required string length: 1+ |

#### Response

`200` — Content retrieval completed. Check each status to determine whether its item succeeded.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `requestId` | `string` | - | Unique identifier for the request. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `results` | `object[]` | - | Successfully retrieved results. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` | - | Result identifier. Pass IDs from Mintlify results in the contents request's ids field. For web results, pass the result URL in urls. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `url` | `string` | - | Canonical source URL. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | - | Source title. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `text` | `string` | - | Matched content when requested. Otherwise, an empty string. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `truncated?` | `boolean` | - | Whether the returned content is shorter than the available content. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `totalCharacters?` | `integer` | - | Number of available characters before truncation. Present when available. Required range: 0 <= x |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `score` | `number` | - | Relative relevance score. Contents responses use 0 because they retrieve selected items rather than rank results. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `source` | `enum<string>` | - | Retrieval source. Available options: mintlify, web |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `siteName` | `string` | - | Documentation site or web hostname. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `breadcrumbs` | `string[]` | - | Documentation hierarchy for the result. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `publishedDate` | `string \| null` | - | Published 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. |
:::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `statuses` | `object[]` | - | Retrieval status for each requested item. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` | - | Requested ID or URL. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `status` | `enum<string>` | - | Retrieval status. Available options: success |
:::

## Related pages

- [Admin](./admin-index.md)
- [Agent](./agent-2-index.md)
- [Agent](./agent-index.md)
- [Agent-ready content](./agent-ready-content-index.md)
- [AI](./ai-index.md)
- [Analytics](./analytics-index.md)
- [API docs](./api-docs-index.md)
- [API reference](./api-reference-index.md)
- [Assistant](./assistant-2-index.md)
- [Assistant](./assistant-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
