# Summarize Document

The "Summarize Document" endpoint allows you to generate a summary of a document stored in Google Drive. This is particularly useful when you need a concise overview of lengthy documents, such as reports, agreements, or presentations. The endpoint also supports optional instructions to tailor the summarization to your specific needs.

### Endpoint

```bash
POST /v1/drive/document-summary
```

### Parameters

* **document\_id** (required, string): The ID of the document you want to summarize. This ID can be obtained from the Document Index or directly from the Google Drive URL.

  Example URL: `https://drive.google.com/file/d/1X2Y3Z4A5B6C7D8E9F/view`

  In this example, the document ID is `1X2Y3Z4A5B6C7D8E9F`.
* **instructions** (optional, string): Additional instructions on how the AI should summarize the document (e.g., "Focus on financial highlights" or "Summarize in bullet points").

**Note:** The user must be logged in with an account that is authorized to access the specified document in Google Drive.

### Example Response

```json
{
  "document_id": "1X2Y3Z4A5B6C7D8E9F",
  "summary": "The document outlines the company's financial performance for 2023, highlighting a 10% increase in revenue, a 5% reduction in operational costs, and a 15% growth in net profit."
}
```

### Usage Notes

* **Document ID Retrieval:** Obtain the document ID from the Google Drive URL or through the Document Index endpoint.
* **Summarization Instructions:** Use the optional `instructions` parameter to guide the AI on what aspects of the document to focus on in the summary.
* **Authorization:** Ensure that you are logged in with an account that has access to the document you are summarizing.

### Example Use Case: Executive Summaries for Reports

In scenarios where executives or team members need quick overviews of detailed reports, the "Summarize Document" endpoint can generate concise summaries that highlight the most critical information. By providing specific instructions, such as focusing on financial data or key action points, you can tailor the summaries to meet your team's needs effectively.


---

# Agent Instructions: 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:

```
GET https://docs.corpdev.ai/corpdev.ai-docs/document-api/summarize-document.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
