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

# uploadDocument

> This API is used to upload compliance and miscellaneous documents to a company for retriveal using the `downloadDocument` API

### When to use:
- When adding documents at a company level
- When adding employee or pay period specific documents

---
Only IDs that pertain to the specific documentType are required to ensure they are routed correctly. 
|Example Document|Requried IDs|
|-|-|
|Paystubs|companyId, employeeId, payPeriodId|
|Payroll journals|companyId, payPeriodId|
|Company handbook|companyId|

### 8655 and W4 forms:
Rollfi supports uploading employee W4s and 8655 forms through the API. These are specified using the documentType

|Document|documentType|Required IDs|
|-|-|-|
|Employee W4|W4Form|companyId, employeeId|
|Company 8655|8655Form|companyId|


### Note:
- Documents should be uploaded in base64 encoding for safe storage and retrieval
- Uploaded documents can be viewed using `getUploadedDocuments` and retrieved from storage using `downloadDocument`



## OpenAPI

````yaml post /adminPortal/uploadDocument
openapi: 3.0.1
info:
  title: Default module
  description: ''
  version: 1.0.0
servers: []
security:
  - basic: []
tags: []
paths:
  /adminPortal/uploadDocument:
    post:
      tags: []
      summary: uploadDocument
      description: >-
        This API is used to upload compliance and miscellaneous documents to a
        company for retriveal using the `downloadDocument` API


        ### When to use:

        - When adding documents at a company level

        - When adding employee or pay period specific documents


        ---

        Only IDs that pertain to the specific documentType are required to
        ensure they are routed correctly. 

        |Example Document|Requried IDs|

        |-|-|

        |Paystubs|companyId, employeeId, payPeriodId|

        |Payroll journals|companyId, payPeriodId|

        |Company handbook|companyId|


        ### 8655 and W4 forms:

        Rollfi supports uploading employee W4s and 8655 forms through the API.
        These are specified using the documentType


        |Document|documentType|Required IDs|

        |-|-|-|

        |Employee W4|W4Form|companyId, employeeId|

        |Company 8655|8655Form|companyId|



        ### Note:

        - Documents should be uploaded in base64 encoding for safe storage and
        retrieval

        - Uploaded documents can be viewed using `getUploadedDocuments` and
        retrieved from storage using `downloadDocument`
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                companyId:
                  type: string
                employeeId:
                  type: string
                payPeriodId:
                  type: string
                fileName:
                  type: string
                documentType:
                  type: string
                fileBase64:
                  type: string
              required:
                - method
                - companyId
                - fileName
                - fileBase64
            example:
              method: uploadDocument
              companyId: 6FFBAEFF-020F-4F63-A140-0348BD0F0FCB
              employeeId: 161978BD-C696-495A-87DC-226B9D0D5A3B
              payPeriodId: D9108BF3-5FFB-433D-89E2-7A4C79972153
              fileName: sample-document.pdf
              documentType: PayStub
              fileBase64: >-
                JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPD4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJXQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDEyIFRmCjcyIDcyMCBUZAooSGVsbG8gV29ybGQpIFRqCkVUCmVuZHN0cmVhbQplbmRvYmoKeHJlZgowIDUKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQ1IDAwMDAwIG4gCnRyYWlsZXIKPDwKL1NpemUgNQovUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKMzM4CiUlRU9G
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  documentId:
                    type: string
                  fileName:
                    type: string
                  success:
                    type: boolean
                  message:
                    type: string
                required:
                  - documentId
                  - fileName
                  - success
                  - message
              example:
                documentId: 181D4FCA-CBDB-49F6-93BE-95B78AD3045E
                fileName: sample-document.pdf
                success: true
                message: Document uploaded successfully
          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: Invalid PayPeriodId
          headers: {}
      deprecated: false
      security:
        - basic: []
components:
  securitySchemes:
    basic:
      type: http
      scheme: basic

````