> ## 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.

# Presigned URL for upload

> Generates a presigned URL that can be used to directly upload a file to storage. Returns the URL and document metadata.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/documents/presigned-upload-url
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/documents/presigned-upload-url:
    post:
      tags:
        - Document
      summary: Presigned URL for upload
      description: >-
        Generates a presigned URL that can be used to directly upload a file to
        storage. Returns the URL and document metadata.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                mimeType:
                  anyOf:
                    - type: string
                      enum:
                        - application/zip
                        - application/x-zip-compressed
                        - multipart/x-zip
                        - application/x-compress
                    - type: string
                      enum:
                        - >-
                          application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
                        - application/vnd.ms-excel
                        - application/vnd.ms-excel.sheet.macroenabled.12
                    - type: string
                      enum:
                        - application/pdf
                    - type: string
                      enum:
                        - text/csv
                    - type: string
                      enum:
                        - application/javascript
                    - type: string
                      enum:
                        - text/css
                    - type: string
                      enum:
                        - image/png
                    - type: string
                      enum:
                        - image/jpeg
                    - type: string
                      enum:
                        - video/mp4
                    - type: string
                      enum:
                        - application/msword
                    - type: string
                      enum:
                        - >-
                          application/vnd.openxmlformats-officedocument.wordprocessingml.document
                    - type: string
                      enum:
                        - text/html
                    - type: string
                      enum:
                        - application/json
                    - type: string
                      enum:
                        - application/fhir+json
                    - type: string
                      enum:
                        - application/fhir+jsonl
                  description: The MIME type of the file to be uploaded.
                fileName:
                  type: string
                  description: The name of the file to be uploaded.
              required:
                - mimeType
                - fileName
              additionalProperties: false
        required: true
      responses:
        '200':
          description: Successfully generated presigned URL and initial 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
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Internal server error while generating the presigned URL.
                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.presigned_upload_url(
                file_name="fileName",
                mime_type="application/zip",
            )
            print(response.id)

````