> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.privategpt.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.privategpt.dev/_mcp/server.

# Retrieve Full Document Content

POST /v1/artifacts/content
Content-Type: application/json

Retrieve the full content of filtered documents.

This endpoint provides access to complete document content rather than
semantic chunks. Use this when you need the entire context of documents
rather than relevant excerpts.

Key Features:
* Full Content: Get complete documents rather than chunks
* Multiple Formats: Return as markdown text or structured objects
* Node Type Filtering: Include or exclude images, tables, and other node types
* Node ID Filtering: Retrieve specific sections by their node IDs
* Filtered Retrieval: Select specific documents using metadata filters
* Bulk Retrieval: Get multiple documents in one request

Format Options:
* markdown (default): Returns flattened markdown text representation
* object: Returns hierarchical tree structure with typed nodes

Content Filtering:
* Use include to retrieve only specific node types
* Use exclude to omit unwanted content types
* Use node_ids to retrieve specific sections or nodes by ID
* Supports TextNode, ImageNode, TableNode, and other node types

Subtree Filtering:
* Specify node_ids to retrieve only certain sections/nodes
* Set include_children=True (default) to get full subtrees
* Set include_children=False to get only specified nodes
* Set include_ancestors=True to include parent context

Notes:
* Node type filtering is applied to all retrieved documents
* Object format preserves document structure and hierarchy
* Markdown format provides a flattened, readable text representation
* When node_ids is specified, returns filtered tree structure

Reference: https://docs.privategpt.dev/api-reference/artifacts/content-retrieval-v-1-artifacts-content-post

## Request

### Body (application/json)

This endpoint expects a ContentBody.

- `context_filter` (ContextFilter, required) — Filter to select documents to retrieve. Supports filtering by collection, artifacts, and metadata.
- `format` (enum, optional) — Format for returned content. 'object' returns structured data, 'markdown' returns content formatted as markdown text.
  - Allowed values: `object`, `markdown`
- `filter` (ContentFilter, optional, nullable) — Content filtering options to include or exclude specific node types. Use this to control the types of content returned in the response.
- `max_tokens` (integer, optional, nullable) — Maximum number of tokens to return in the content. If not set, returns full content of the documents.

## Response

### 200

Successful content retrieval

- `data` (list of ContentDocumentResponse, required) — List of documents with their full content

## Errors

### 401 Unauthorized Error

Unauthorized

- `any`

### 422 Unprocessable Entity Error

Validation Error - Invalid request parameters

- `detail` (OpenApiValidationErrorResponseDetail, required) — Error detail — a string message or a list of validation error objects.

## Types

### ContextFilter

Filter by collection, artifacts and metadata in the ingested context. The main filter is the collection the context is part of. All artifacts ids are ensured to be part of the context. If any of the ids is not usable in the context (i.e. doesn't exist), the related task will fail. The metadata filter will look for all context matching the metadata, if any, and add it to the context. The filter is a dictionary of key-value pairs. The key is the metadata key, and the value is the metadata value. If both artifacts and metadata filters are provided, the result will be the intersection of the two filters.

- `collection` (string, optional, default: pgpt_collection) — The name of the collection to filter on.
- `artifacts` (list of string, optional, nullable) — Artifacts ids to filter on.
- `metadata_filter` (list of map from string to any, optional, nullable) — Metadata filter to apply on the context.

### ContentFilter

Filter the content by node types to include in the response.

- `include` (list of enum, optional, nullable) — List of node types to include in the content response. If not specified, all node types will be included. Example node types include TextNode, ImageNode, TableNode, etc.
  - Allowed values: `ImageNode`, `ListItemNode`, `ListNode`, `SectionNode`, `TableNode`, `TableRowNode`, `TextNode`
- `exclude` (list of enum, optional, nullable) — List of node types to exclude from the content response. If not specified, no node types will be excluded. Example node types include TextNode, ImageNode, TableNode, etc.
  - Allowed values: `ImageNode`, `ListItemNode`, `ListNode`, `SectionNode`, `TableNode`, `TableRowNode`, `TextNode`
- `node_ids` (list of string, optional, nullable) — List of specific node IDs to retrieve from the document tree. When specified, only these nodes (and optionally their children) will be returned. Useful for retrieving specific sections or parts of a document. Example: ['382b0aab-3c63-44a1-ae2e-1ee234009d6e', '6d2a3086-10bc-4d76-885b-2208c211b648']
- `include_children` (boolean, optional, default: true) — When node_ids is specified, determines whether to include the full subtree below each selected node. If True (default), returns complete subtrees. If False, returns only the specified nodes without their descendants.
- `include_ancestors` (boolean, optional, default: false) — When node_ids is specified, determines whether to include ancestor nodes in the path from each selected node to the document root. If True, provides structural context. If False (default), returns only selected subtrees.

### ContentDocumentResponse

Individual document response with full content.

- `artifact_id` (string, required) — Identifier of the document
- `content` (ContentDocumentResponseContent, required) — Full text content of the document

### OpenApiValidationErrorResponseDetail

Error detail — a string message or a list of validation error objects.

### ContentDocumentResponseContent

Full text content of the document

### ContentTree

Structured representation of document content as a tree.

- `id` (string, required) — Unique identifier of the node
- `type` (string, required) — Type of the node (e.g., section, paragraph)
- `content` (string, required) — Text content of the node
- `children` (list of ContentTree, optional) — Child nodes representing nested content structure

## Examples

### Complete document content in markdown format

**Request**

```json
{}
```

**Response**

```json
{
  "data": [
    {
      "artifact_id": "annual_report_2023",
      "content": "ANNUAL REPORT 2023\n\nExecutive Summary\n\nFiscal year 2023 marked a transformative period for our organization with record-breaking performance across all key metrics...\n\n[Full document content continues...]"
    },
    {
      "artifact_id": "quarterly_summary_q4",
      "content": "Q4 QUARTERLY SUMMARY\n\nQuarter Overview\n\nThe fourth quarter concluded our strongest year on record, with revenue growth of 34% year-over-year...\n\n[Full document content continues...]"
    }
  ]
}
```

**SDK Code**

```python Complete document content in markdown format
import requests

url = "https://api.example.com/v1/artifacts/content"

payload = {}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Complete document content in markdown format
const url = 'https://api.example.com/v1/artifacts/content';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Complete document content in markdown format
package main

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

func main() {

	url := "https://api.example.com/v1/artifacts/content"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Complete document content in markdown format
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/artifacts/content")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java Complete document content in markdown format
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/artifacts/content")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php Complete document content in markdown format
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/artifacts/content', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Complete document content in markdown format
using RestSharp;

var client = new RestClient("https://api.example.com/v1/artifacts/content");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Complete document content in markdown format
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/artifacts/content")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Structured document content as tree objects

**Request**

```json
{}
```

**Response**

```json
{
  "data": [
    {
      "artifact_id": "annual_report_2023",
      "content": "ANNUAL REPORT 2023\n\nExecutive Summary"
    }
  ]
}
```

**SDK Code**

```python Structured document content as tree objects
import requests

url = "https://api.example.com/v1/artifacts/content"

payload = {}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Structured document content as tree objects
const url = 'https://api.example.com/v1/artifacts/content';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Structured document content as tree objects
package main

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

func main() {

	url := "https://api.example.com/v1/artifacts/content"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Structured document content as tree objects
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/artifacts/content")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java Structured document content as tree objects
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/artifacts/content")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php Structured document content as tree objects
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/artifacts/content', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Structured document content as tree objects
using RestSharp;

var client = new RestClient("https://api.example.com/v1/artifacts/content");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Structured document content as tree objects
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/artifacts/content")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Documents with node type filtering

**Request**

```json
{}
```

**Response**

```json
{
  "data": [
    {
      "artifact_id": "finance_report_dec",
      "content": "DECEMBER FINANCIAL REPORT\n\nRevenue Analysis\n\nDecember revenue reached $850K, representing a 12% increase from November..."
    }
  ]
}
```

**SDK Code**

```python Documents with node type filtering
import requests

url = "https://api.example.com/v1/artifacts/content"

payload = {}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Documents with node type filtering
const url = 'https://api.example.com/v1/artifacts/content';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Documents with node type filtering
package main

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

func main() {

	url := "https://api.example.com/v1/artifacts/content"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Documents with node type filtering
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/artifacts/content")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java Documents with node type filtering
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/artifacts/content")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php Documents with node type filtering
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/artifacts/content', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Documents with node type filtering
using RestSharp;

var client = new RestClient("https://api.example.com/v1/artifacts/content");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Documents with node type filtering
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/artifacts/content")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Specific sections retrieved by node IDs

**Request**

```json
{}
```

**Response**

```json
{
  "data": [
    {
      "artifact_id": "annual_report_2023",
      "content": "Introduction\n\nKey Players in the Streaming Wars"
    }
  ]
}
```

**SDK Code**

```python Specific sections retrieved by node IDs
import requests

url = "https://api.example.com/v1/artifacts/content"

payload = {}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Specific sections retrieved by node IDs
const url = 'https://api.example.com/v1/artifacts/content';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Specific sections retrieved by node IDs
package main

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

func main() {

	url := "https://api.example.com/v1/artifacts/content"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Specific sections retrieved by node IDs
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/artifacts/content")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java Specific sections retrieved by node IDs
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/artifacts/content")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php Specific sections retrieved by node IDs
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/artifacts/content', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Specific sections retrieved by node IDs
using RestSharp;

var client = new RestClient("https://api.example.com/v1/artifacts/content");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Specific sections retrieved by node IDs
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/artifacts/content")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```