---
title: "Summarize documents"
method: POST
path: "/rest/api/v1/summarize"
tags: ["Summarize"]
---

# Summarize documents

`POST /rest/api/v1/summarize`

Generate an AI summary of the requested documents.

## Query parameters

- `locale` string

## Request body

- SummarizeRequest — Summary of the document
  - `timestamp` string, date-time — The ISO 8601 timestamp associated with the client request.
  - `query` string — Optional query that the summary should be about
  - `preferredSummaryLength` integer — Optional length of summary output. If not given, defaults to 500 chars.
  - `documentSpecs` DocumentSpec[], required — Specifications of documents to summarize
    - union
      - object
        - `url` string, required — The URL of the document.
      - object
        - `id` string, required — The ID of the document.
      - object
        - `ugcType` 'ANNOUNCEMENTS' | 'ANSWERS' | 'COLLECTIONS' | 'SHORTCUTS' | 'CHATS', required — The type of the user generated content (UGC datasource).
        - `contentId` integer, required — The numeric id for user generated content. Used for ANNOUNCEMENTS, ANSWERS, COLLECTIONS, SHORTCUTS.
        - `docType` string — The specific type of the user generated content type.
      - object
        - `ugcType` 'ANNOUNCEMENTS' | 'ANSWERS' | 'ARTIFACTS' | 'COLLECTIONS' | 'SHORTCUTS' | 'CHATS', required — The type of the user generated content (UGC datasource).
        - `ugcId` string, required — The string id for user generated content. Used for CHATS.
        - `docType` string — The specific type of the user generated content type.
  - `trackingToken` string — An opaque token that represents this particular result. To be used for /feedback reporting.

## Response `200`

OK

- SummarizeResponse
  - `error` object
    - `message` string
  - `summary` Summary
    - `text` string
    - `followUpPrompts` string[] — Follow-up prompts based on the summarized doc
  - `trackingToken` string — An opaque token that represents this summary in this particular query. To be used for /feedback reporting.

## Other responses

- `400` — Invalid request
- `401` — Not Authorized
- `429` — Too Many Requests

---

[API](https://skmtc.net/gleanwork/apis/glean-api.md) · [All operations](https://skmtc.net/gleanwork/apis/glean-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gleanwork/glean-api/revisions/ebd602e4aea4/schema)
