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

# Get a Document

> Fetch detailed information on a single Document by its unique ID



## OpenAPI

````yaml GET /api/document/{document_id}
openapi: 3.0.3
info:
  title: Petal API Document
  description: Reference document for Petal app
  license:
    name: MIT
  version: 1.2.5
servers:
  - url: https://cite.petal.org
security:
  - bearerAuth: []
tags:
  - name: signup
  - name: extraction
  - name: referral
  - name: site
  - name: citegen
  - name: invite
  - name: user
  - name: tag
  - name: ai
  - name: notification
  - name: organization
  - name: annotation
  - name: search
  - name: attachment
  - name: collection
  - name: discourse
  - name: main
  - name: ai-create
  - name: document
  - name: payment
  - name: comment
  - name: lambda
  - name: sauce
  - name: admin
  - name: error
  - name: opengraph
  - name: default
  - name: media
  - name: file
  - name: oauth
paths:
  /api/document/{document_id}:
    get:
      tags:
        - document
      summary: Read a document
      description: Fetch detailed information on a single Document by its unique ID
      operationId: get_/api/document/{document_id}
      parameters:
        - description: The unique ID of the Document
          in: path
          name: document_id
          required: true
          schema:
            format: int32
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentReadResponse'
          description: OK
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
          description: Unprocessable Entity
components:
  schemas:
    DocumentReadResponse:
      additionalProperties: false
      properties:
        annotation_ids:
          items:
            type: integer
          title: Annotation IDs
          description: Unique IDs of Annotations made on this Document
          type: array
        annotations:
          items:
            $ref: '#/components/schemas/Annotation'
          title: Annotations
          description: Detailed Annotations made on this Document
          type: array
        comments:
          items:
            $ref: '#/components/schemas/Comment'
          title: Comments
          description: Detailed comments made on the Annotations
          type: array
        created_at:
          title: Created At
          description: Creation time, by UTC
          type: string
        csl:
          title: CSL
          description: CSL reference info for internal use
          type: object
        doctype:
          title: Doctype
          description: Type of file, such as pdf, txt, etc.
          type: string
        file_resource_size:
          title: File Resource Size
          description: Size of extracted information
          type: integer
        file_size:
          title: File Size
          description: Size of original file
          type: integer
        filename:
          title: Filename
          description: Name of original file
          type: string
        id:
          title: ID
          description: Unique ID of the Document
          type: integer
        is_trash:
          title: Is Trash
          description: Is the Document in Workspace trash
          type: boolean
        keywords:
          items: {}
          title: Keywords
          description: Keywords for internal use
          type: array
        meta:
          title: Meta
          description: Metadata, for internal use
          type: object
        modified_at:
          title: Modified At
          description: Modification time, by UTC
          type: string
        modified_by:
          title: Modified By
          description: Last user to modify
          type: integer
        organization_id:
          title: Organization ID
          description: Unique ID of Organization
          type: integer
        pages:
          title: Pages
          description: Number of pages in Document
          type: integer
        ranking:
          title: Ranking
          description: Search ranking if applicable
          type: integer
        resource_size:
          title: Resource Size
          description: Internal resource usage
          type: integer
        resource_stats:
          $ref: '#/components/schemas/DocumentResourceStats'
        snippet:
          title: Snippet
          description: Snippet found through search, if applicable
          type: string
        span:
          items:
            type: integer
          title: Span
          description: For UI use
          type: array
        status:
          additionalProperties:
            type: integer
          title: Status
          description: Processing status of Document
          type: object
        suggested_tags:
          items:
            $ref: '#/components/schemas/SuggestedTag'
          title: Suggested Tags
          description: Auto suggested tags
          type: array
        tag_ids:
          items:
            type: integer
          title: Tag IDs
          description: IDs of tags on this Document
          type: array
        tasks:
          items:
            $ref: '#/components/schemas/Task'
          title: Tasks
          description: Queued tasks associated with this Document
          type: array
        ui:
          title: UI
          description: UI information for internal use
          type: object
        use_ocr:
          title: Use OCR
          description: >-
            Whether or not to use OCR on this Document. Leave as False except
            for images
          type: boolean
        user:
          $ref: '#/components/schemas/UserSimple'
      required:
        - annotation_ids
        - created_at
        - modified_at
        - modified_by
        - id
        - is_trash
        - use_ocr
        - meta
        - csl
        - ui
        - status
        - organization_id
        - tag_ids
        - user
        - doctype
        - file_size
        - pages
        - resource_size
        - file_resource_size
      title: DocumentReadResponse
      type: object
    ValidationError:
      description: Model of a validation error response.
      items:
        $ref: '#/components/schemas/ValidationError.ValidationErrorElement'
      title: ValidationError
      type: array
    Annotation:
      additionalProperties: false
      properties:
        comment_count:
          title: Comment Count
          description: Number of comments on Annotation
          type: integer
        created_at:
          title: Created At
          description: Creation time, by UTC
          type: string
        description:
          title: Description
          description: Text description of Annotation
          type: string
        document_id:
          title: Document ID
          description: Unique ID of the Document
          type: integer
        id:
          title: ID
          description: Unique ID of the Annotation
          type: integer
        is_hidden:
          title: Is Hidden
          description: Whether the Annotation is hidden from other users
          type: boolean
        modified_at:
          title: Modified At
          description: Modification time, by UTC
          type: string
        modified_by:
          title: Modified By
          description: Last user to modify
          type: integer
        type:
          title: Type
          description: Whether the Annotation is on text or an image (rectangular)
          type: string
        use_ocr:
          title: Use OCR
          description: >-
            Whether or not to use OCR on this Annotation. Leave as False except
            for images
          type: boolean
        user_id:
          title: User ID
          description: ID of user who created this Annotation
          type: integer
      required:
        - id
        - type
        - description
        - document_id
        - user_id
        - comment_count
        - is_hidden
        - use_ocr
        - created_at
        - modified_at
        - modified_by
      title: Annotation
      type: object
    Comment:
      additionalProperties: false
      properties:
        annotation_id:
          title: Annotation ID
          description: Unique ID of Annotation this comment belongs to
          type: integer
        content:
          title: Content
          description: Text content of the comment
          type: string
        created_at:
          title: Created At
          description: Creation time, by UTC
          type: string
        id:
          title: ID
          description: Unique ID of comment
          type: integer
        modified_at:
          title: Modified At
          description: Modification time, by UTC
          type: string
        modified_by:
          title: Modified By
          description: Last user to modify
          type: integer
        user:
          $ref: '#/components/schemas/UserSimple'
        user_id:
          title: User ID
          description: Unique ID of user to create comment
          type: integer
      required:
        - id
        - annotation_id
        - user_id
        - created_at
        - modified_at
        - modified_by
        - content
        - user
      title: Comment
      type: object
    DocumentResourceStats:
      additionalProperties: false
      properties:
        file_list:
          title: File List
        file_size:
          title: File Size
          type: integer
        file_size_by_mime_type:
          title: File Size By Mime Type
        file_size_by_res_type:
          title: File Size By Res Type
      required:
        - file_size
      title: DocumentResourceStats
      description: Detailed description of disk usage by a given Document
      type: object
    SuggestedTag:
      additionalProperties: false
      properties:
        color:
          title: Color
          type: string
        document_count:
          title: Document Count
          type: integer
        id:
          title: ID
          type: integer
        name:
          title: Name
          type: string
        organization_id:
          title: Organization ID
          type: integer
      required:
        - id
        - organization_id
        - name
        - color
        - document_count
      title: SuggestedTag
      description: Detailed information of a tag
      type: object
    Task:
      additionalProperties: false
      properties:
        args_json:
          title: Args Json
          type: string
        created_at:
          title: Created At
        function:
          title: Function
          type: string
        group_id:
          title: Group ID
          type: string
        id:
          title: ID
          type: string
        module:
          title: Module
          type: string
        nrequeue:
          title: Nrequeue
          type: integer
        parent_id:
          title: Parent ID
          type: integer
        parent_table:
          title: Parent Table
          type: string
        runtime:
          title: Runtime
          type: number
        status:
          title: Status
          type: string
        traceback:
          title: Traceback
          type: string
        updated_at:
          title: Updated At
      required:
        - id
      title: Task
      type: object
    UserSimple:
      additionalProperties: false
      properties:
        id:
          title: ID
          description: Unique ID of user
          type: integer
        name:
          title: Name
          description: Name of user
          type: string
      required:
        - id
      title: UserSimple
      type: object
    ValidationError.ValidationErrorElement:
      description: Model of a validation error response element.
      properties:
        ctx:
          title: Error context
          type: object
        loc:
          items:
            type: string
          title: Missing field name
          type: array
        msg:
          title: Error message
          type: string
        type:
          title: Error type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationErrorElement
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````