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

# Document metadata

> Retrieves metadata for a specific document, including a presigned URL for direct access if applicable.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml get /api/v2/documents/{documentId}/metadata
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/documents/{documentId}/metadata:
    get:
      tags:
        - Document
      summary: Document metadata
      description: >-
        Retrieves metadata for a specific document, including a presigned URL
        for direct access if applicable.
      parameters:
        - schema:
            type: string
          in: query
          name: includeSize
          required: false
          description: >-
            Whether to include file size from S3 (in bytes). Adds a small
            latency overhead.
        - schema:
            type: string
          in: path
          name: documentId
          required: true
          description: The unique identifier of the document.
      responses:
        '200':
          description: Successfully retrieved document metadata.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  fileName:
                    type: string
                  pdfPageCount:
                    type: integer
                    minimum: 0
                    nullable: true
                    description: >-
                      The number of pages in the PDF, or null for non-PDFs and
                      PDFs that have not been counted yet.
                  presignedUrl:
                    type: string
                    format: uri
                  size:
                    type: number
                    nullable: true
                    description: The size of the file in bytes.
                required:
                  - id
                  - fileName
                  - pdfPageCount
                  - presignedUrl
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: The error message.
                  message:
                    type: string
                    description: The message.
                  statusCode:
                    type: number
                    description: The status code.
                  details:
                    type: object
                    additionalProperties: {}
                    description: The details of the error
                additionalProperties: true
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: >-
                      Not Found, the document with the specified ID does not
                      exist.
                required:
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Internal server error while fetching document metadata.
                required:
                  - error
                additionalProperties: false
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from samplehc import SampleHealthcare

            client = SampleHealthcare(
                api_key=os.environ.get("SAMPLEHC_API_KEY"),  # This is the default and can be omitted
            )
            response = client.v2.documents.retrieve_metadata(
                document_id="documentId",
            )
            print(response.id)

````