> ## Documentation Index
> Fetch the complete documentation index at: https://developers.luminpdf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Summarize Document

> Generate an AI-powered summary of a PDF document's text content.

<Accordion title="Required scopes (OAuth 2.0)" icon="key">
  This endpoint requires the following scope:

  `pdf:files`
</Accordion>


## OpenAPI

````yaml tabs/api-reference/lumin-openapi.yaml POST /documents/summarize
openapi: 3.1.0
info:
  version: 1.0.0
  title: Lumin API Reference
  description: >
    The Lumin API Reference provides a comprehensive set of tools to integrate
    document workflows — including editing, eSignatures, and automation — into
    your applications.


    Useful links:

    - [Document Repository](https://github.com/luminpdf/luminsign-docs)

    - [API
    Definition](https://github.com/luminpdf/luminsign-docs/blob/main/openapi.yaml)

    - [Authentication Guide](/tabs/guides/authentication/overview)
  termsOfService: https://www.luminpdf.com/terms-of-use/
  contact:
    name: API Support
    email: integration@luminpdf.com
    url: https://help.luminpdf.com
servers:
  - url: https://api.luminpdf.com/v1
    description: Production server
security: []
tags:
  - name: Signature Requests
    description: Everything about Signature Requests
  - name: Users
    description: Everything about Users
  - name: Templates
    description: Everything about Templates
  - name: Documents
    description: Everything about Documents
  - name: Workspaces
    description: Everything about Workspaces
  - name: Agreements
    description: Everything about Agreements
paths:
  /documents/summarize:
    post:
      tags:
        - Documents
      summary: Summarize Document
      description: >
        Generate a concise AI-powered summary of a PDF document's text content.


        The document can be specified by a Lumin document ID or by a publicly
        accessible file URL.


        **Supported file type:** PDF only.


        **Supported languages:** English, Spanish, French, Vietnamese,
        Portuguese.


        **Content requirements:**

        - The document must contain extractable text (not scanned images).

        - Minimum content: 50 words.

        - Maximum content: 48,000 characters (including spaces).


        **Rate limits:**

        - Pro, Business, Old Enterprise plans: 200 requests/day/user.

        - Other plans: 100 requests/lifetime.


        **Caching:** Summaries are cached on the server. If the document has not
        been modified since the last summarization, the cached summary is
        returned without consuming a rate-limit token. Use `regenerate: true` to
        bypass the cache and produce a fresh summary.


        Password-protected documents cannot be summarized.


        **File URL restrictions:** Only URLs from allowed domains are accepted
        (`api.luminpdf.com`, `*.s3.amazonaws.com`, `*.s3.*.amazonaws.com`).
        Redirecting URLs are not supported.


        **Input priority:** If both `document_id` and `file_url` are provided,
        `document_id` takes priority and `file_url` is ignored.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentSummarizeRequest'
            examples:
              summarize:
                summary: Summarize a document
                value:
                  document_id: 695dd6880d951f4de70a7c5d
              regenerate:
                summary: Force regeneration
                value:
                  document_id: 695dd6880d951f4de70a7c5d
                  regenerate: true
      responses:
        '200':
          description: Returns the AI-generated summary.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentSummarizeResponse'
              example:
                document_id: 695dd6880d951f4de70a7c5d
                document_name: Patient Information Form.pdf
                summary: >-
                  This document is a patient information form for a prescription
                  medication. It collects personal details including name, date
                  of birth, address, and insurance information.
                language: en
                character_count: 12480
                cached: false
                remaining_requests: 7
        4XX:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKey: []
        - BearerAuth:
            - pdf:files
components:
  schemas:
    DocumentSummarizeRequest:
      type: object
      properties:
        document_id:
          type: string
          description: >
            Lumin document ID of the PDF to summarize.

            Required when `file_url` is not provided. Takes priority if both are
            provided.


            To obtain a document ID, upload the file to Lumin first using
            [Upload
            Document](/tabs/api-reference/api/documents/create-document).
        file_url:
          type: string
          format: uri
          description: >
            Publicly accessible URL of the PDF file to summarize.

            Required when `document_id` is not provided. Ignored if
            `document_id` is also provided.
        regenerate:
          type: boolean
          default: false
          description: >-
            If `true`, bypass the cached summary and generate a fresh one. This
            counts against the rate limit.
    DocumentSummarizeResponse:
      type: object
      required:
        - document_id
        - document_name
        - summary
        - language
        - character_count
        - cached
        - remaining_requests
      properties:
        document_id:
          type: string
          description: ID of the document that was summarized.
        document_name:
          type: string
          description: Name of the document.
        summary:
          type: string
          description: The AI-generated summary text.
        language:
          type: string
          enum:
            - en
            - es
            - fr
            - vi
            - pt
          description: Detected language of the document content.
        character_count:
          type: integer
          description: >-
            Total number of characters in the source document (including
            spaces).
        cached:
          type: boolean
          description: >-
            `true` if the response was served from cache; `false` if a fresh
            summary was generated.
        remaining_requests:
          type: integer
          description: Number of summarize requests the user has remaining for today.
    Error:
      type: object
      required:
        - error_code
        - error_message
      properties:
        error_code:
          type: string
          description: The system error code.
        error_message:
          type: string
          description: The human-readable error message.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >
        Provide your API key in the `X-API-Key` header, e.g., `X-API-Key:
        YOUR_API_KEY`.
    BearerAuth:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://auth.luminpdf.com/oauth2/auth
          tokenUrl: https://auth.luminpdf.com/oauth2/token
          scopes:
            openid: >-
              Retrieve basic identity details (username, email, profile
              picture).
            offline_access: Request a refresh token for long-lived access. Private apps only.
            profile.read: View basic user profile information.
            workspaces: View and manage Workspaces and Spaces.
            workspaces.read: View information about the authenticated user's Workspace.
            templates: View and manage templates in a Workspace.
            pdf:files: Create, edit, and delete PDF files in a Workspace.
            pdf:files.read: Retrieve PDF documents stored in a Workspace.
            sign:requests: Create, update, or view signature requests.
            sign:requests.read: Retrieve signature requests.
            agreements: Create, update, or delete AgreementGen documents.
      description: >
        OAuth 2.0 authorization code flow. Provide your access token in the
        `Authorization` header, e.g., `Authorization: Bearer <token>`. See the
        [OAuth 2.0 guide](/tabs/guides/authentication/oauth2) for details.

````