> For the complete documentation index, see [llms.txt](https://docs.autocontentapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autocontentapi.com/quick-start/documents/retrieve-and-download.md).

# List, Fetch, and Download Documents

Once a briefing document has been generated successfully, you can manage it through the dedicated `/documents` endpoints.

## 1. List Documents

```bash
curl -X GET "https://api.autocontentapi.com/documents/get?page=1&pageSize=20" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

Example response:

```json
{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "briefing_doc",
      "format": "pdf",
      "title": "Briefing Document: AI Procurement in Healthcare",
      "createdOn": "2026-03-11T19:12:00Z",
      "status": 100
    }
  ],
  "totalCount": 1,
  "page": 1,
  "pageSize": 20,
  "totalPages": 1
}
```

## 2. Fetch One Document

```bash
curl -X GET "https://api.autocontentapi.com/documents/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

For `format: "pdf"`, the response includes `url`. For `format: "text"` or `format: "html"`, the response includes `content`.

## 3. Download the Stored Result

```bash
curl -L "https://api.autocontentapi.com/documents/550e8400-e29b-41d4-a716-446655440000/download" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -o briefing-document.pdf
```

The download endpoint returns the stored result using the correct file extension and content type.

## 4. Poll with `/content/Status/{id}` While Waiting

`/documents/{id}` only returns a result after the document has been generated successfully. While the request is still running, use `/content/Status/{id}`:

```bash
curl -X GET "https://api.autocontentapi.com/content/Status/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

**Tips**

* Treat `/content/Status/{id}` as the job-status API.
* Treat `/documents/get` and `/documents/{id}` as the document library API.
* For `pdf`, you can either read `document_url` from the status response or `url` from `/documents/{id}`.

## Try it in code

* [C#](/code-samples/documents/csharp/retrieve-and-download.md)
* [Node.js](/code-samples/documents/nodejs/retrieve-and-download.md)
* [Java](/code-samples/documents/java/retrieve-and-download.md)
* [PHP](/code-samples/documents/php/retrieve-and-download.md)
* [Python](/code-samples/documents/python/retrieve-and-download.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.autocontentapi.com/quick-start/documents/retrieve-and-download.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
