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

# downloadDocument

> The `downloadDocument` API is used to download a Base64 encoded PDF document

### When to use:
- When retrieving a pre filled W4 or 8655 to be signed and uploaded
- When retrieving a document that was already uploaded to Rollfi

### Required fields:
|Document Description|Required Fields|
|-|-|
|Document uploaded to Rollfi using the uploadDocument API|documentId|
|Pre filled 8655 without signature|companyId, documentType|
|Pre filled W4 without signature|companyId, employeeId, documentType|



## OpenAPI

````yaml get /adminPortal/downloadDocument
openapi: 3.0.1
info:
  title: Default module
  description: ''
  version: 1.0.0
servers: []
security:
  - basic: []
tags: []
paths:
  /adminPortal/downloadDocument:
    get:
      tags: []
      summary: downloadDocument
      description: >-
        The `downloadDocument` API is used to download a Base64 encoded PDF
        document


        ### When to use:

        - When retrieving a pre filled W4 or 8655 to be signed and uploaded

        - When retrieving a document that was already uploaded to Rollfi


        ### Required fields:

        |Document Description|Required Fields|

        |-|-|

        |Document uploaded to Rollfi using the uploadDocument API|documentId|

        |Pre filled 8655 without signature|companyId, documentType|

        |Pre filled W4 without signature|companyId, employeeId, documentType|
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                documentId:
                  type: string
                companyId:
                  type: string
                employeeId:
                  type: string
                documentType:
                  type: string
                  enum:
                    - 8655Form
                    - W4Form
              required:
                - method
            examples:
              '1':
                value:
                  method: downloadDocument
                  companyId: 82CCB239-764C-49BA-A3A8-00B9C37A59D4
                  documentType: 8655Form
                summary: Pre-fill 8655
              '2':
                value:
                  method: downloadDocument
                  documentId: 179F3EE8-8CF4-4C4F-8430-5C25C9E190F9
                summary: by documentId
              '3':
                value:
                  method: getUploadedDocuments
                  companyId: 28FCB32E-29FE-4269-8AA3-011E7276EF5E
                  employeeId: FA937C14-5DFE-40B3-B2C2-19BA2E988DCF
                summary: Pre-fill W4
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  documentId:
                    type: string
                  companyId:
                    type: string
                  employeeId:
                    type: string
                    nullable: true
                  payPeriodId:
                    type: string
                    nullable: true
                  fileName:
                    type: string
                  documentType:
                    type: string
                  fileBase64:
                    type: string
                  downloadCount:
                    type: integer
                required:
                  - documentId
                  - companyId
                  - fileName
                  - documentType
                  - fileBase64
                  - downloadCount
              example:
                documentId: 24A9F639-689C-4E7D-80CB-14AD3A608B21
                companyId: 6FFBAEFF-020F-4F63-A140-0348BD0F0FCB
                employeeId: 161978BD-C696-495A-87DC-226B9D0D5A3B
                payPeriodId: null
                fileName: sample-document.pdf
                documentType: Team Documents
                fileBase64: >-
                  JVeLjz9MKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2sssVzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPD4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8ChegHl80UERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJXQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDEyIFRmCjcyIDcyMCBUZAooSGVsbG8gV29ybGQpIFRqCkVUCmVuZHN0cmVhbQplbmRvYmoKeHJlZHwgHllLMha6Gh9DAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMAowMDAwMDAwMjQ1IDAwMDAwIG4gCnRyYWlsZXIKPDwKL1NpemUgNQovUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKMzM4CiUlRU9G
                downloadCount: 1
          headers: {}
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
              example:
                error:
                  code: 400
                  message: documentId is required
          headers: {}
      deprecated: false
      security:
        - basic: []
components:
  securitySchemes:
    basic:
      type: http
      scheme: basic

````