# Upload documents by fund

This API endpoint is designed to facilitate secure and time-limited file uploads using presigned URLs. Here's how it works:
**Generate Presigned URL**
When you call the API endpoint, it returns a presigned URL based on the document metadata you provide.
The presigned URL is valid for 5 minutes only. This URL is configured for a PUT request, which allows you to upload the     file directly to the storage location.
**Upload the File**
Use the presigned URL to upload your document.
Ensure you include the required headers when making the PUT request.
**Uploading Multiple Documents**
To upload multiple files, structure your request to include multipe document metadata entries in the body.
The API will return a list of presigned URLs, one for each document.
You must then upload each file individually using its corresponding       presigned URL.
To ensure successful upload, the following conditions must be met:
**Required JSON Body Fields:**
- `Documents.Filename`
Name of the file to be uploaded. Must not exceed 50 characters Supported file types include "bmp","csv","doc","docx","eml","gif","gz","jpeg","jpg","msg","pdf","png","rtf","tif","tiff","txt","xls","xlsm","xlsx","xml","zip","mp4","heic". You MUST specify the extension of the file type at the end of the filename. Example: "Tax Statement.pdf"
- `Documents.SHA256`
SHA-256 hash of the file content used for integrity verification. Must match the hash of the uploaded file. This value can be generated - Most programming languages provide built-in libraries or functions to compute SHA256 hashes. Below is a sample of using Python library.

```
python
import hashlib
data = "your string or file content here".encode('utf-8')
sha256_hash = hashlib.sha256(data).hexdigest()
print(sha256_hash)
```
- `Documents.Filesize`
Size of the file in bytes. Must match the actual file size. Largest file size is 200mb.

**Optional JSON Body Fields:**
- `Documents.Description`
Description of the document. Max 1000 characters. Allowed special characters: `. , ; : ! ? \ - ( ) & ' " / \`
- `Documents.EffectiveTime`
Timestamp indicating as Document Date within the application.
- `Tags.id`
Unique identifier for the tag used to categorise the document.
- `Tags.externalId`
External system identifier for the tag.
- `Tags.tagType`
Type of tag (e.g., `Custom` for user-defined tags).
- `IgnoreDefaultTag`
If `"true"`, default tags will be ignored during upload.
If `"false"`, the relevant financial year system tag will be added. i.e FY2026
- `UseUniqueName`
If `"true"`, appends a number to the filename to avoid duplication.
- `KeepName`
If `"true"`, allows duplicate uploads with the same filename.

**Required Headers must be supplied to the Presigned URL:**
- `x-amz-meta-sha256` Must match the value of   Documents.SHA256
- `Content-Type` Must reflect the actual file type. Example: application/pdf if a pdf document is uploaded.
- `Content-Length` Must match the file size provided   in the body
- `Host` value must be the baseurl/domain of the presigned url returned from the POST request. In our example it is : https://class-dms-staging-pie.s3.ap-southeast-2.amazonaws.com
Be mindful of the environment for the presigned url in our example it displays as "-pie", where this value can change depending on the environment where you call our endpoint. "-prod" if its referencing to our Production environment.

Endpoint: POST /f/{businessCode}/{fundCode}/dms/documents/presigned-upload
Version: 1.0.2
Security: Class_oAuth

## Security:

  - `Class_oAuth` (unknown)
    oAuth2 scopes: fund.read, fund.maintain

## Path parameters:

  - `businessCode` (string, required)
    Class business code

  - `fundCode` (string, required)
    Class entity code

  - `version` (string, required)
    API version

## Request fields (application/json):

  - `Documents` (array, required)

  - `Documents.Filename` (string, required)
    Name of the file to be uploaded. Must not exceed 50     characters. Supported file types include PDF, MP4, HEIC, and other     standard document formats.
    Example: Refresh Token and Access Token Usage.pdf

  - `Documents.Filesize` (string, required)
    Size of the file in bytes. Large files in MBs/GBs are     supported but may require additional validation.
    Example: 70000

  - `Documents.SHA256` (string, required)
    SHA-256 hash of the file content used for integrity     verification. Must match the hash of the uploaded file.
    Example: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b78    52b854

  - `Documents.Description` (string)
    Description of the document. Must not exceed 1000     characters. Only allowed special characters are . , ; : ! ? \ - ( ) & '     " / \
    Example: 2025_08_26 - My New Text File

  - `Documents.EffectiveTime` (string)
    Timestamp indicating the document creation time. Displayed in the application as the CreatedBy time.
    Example: 2025-08-26

  - `Documents.Tags` (array)

  - `Documents.Tags.id` (string)
    Unique identifier for the tag used to categorise the     document.
    Example: 301afb8a-0193-4c87-a16f-636565f7cd66

  - `Documents.Tags.externalId` (string)
    External identifier for the tag, used for integration with    external     systems.
    Example: 301afb8a-0193-4c87-a16f-636565f7cd66

  - `Documents.Tags.tagType` (string)
    Type of the tag. For example, 'Custom' indicates a user    -defined tag.
    Example: Custom

  - `IgnoreDefaultTag` (string)
    Flag to indicate whether default tags should be ignored during     upload. Accepts 'true' or 'false'.
    Example: false

  - `UseUniqueName` (string)
    Flag to append a unique number to the filename to avoid     duplication. Accepts 'true' or 'false'.
    Example: false

  - `KeepName` (string)
    Flag to allow duplicate uploads with the same filename. Accepts 'true' or 'false'.
    Example: false

## Response 200:

  - `200` (unknown)
    Success (Ok). Pre-signed URL successfully generated.

## Response 200 fields (application/json):

  - `messageGroupId` (object)
    Unique identifier for the upload message group.
    Example: fdf9c2da-4042-4498-bd4a-1a0118cfdd0c

  - `documents` (array)
    List of documents with their pre-signed upload URLs.

  - `documents.uploadId` (string)
    Unique identifier for this upload.
    Example: 938b136f-7fd5-4628-894d-9ed5a0197fa3

  - `documents.url` (string)
    Pre-signed URL to upload the document to.
    Example: https://class-dms-staging-pie.s3.ap-southeast-2.amazonaws.com/blob/938b136f-7fd5-4628-894d-9ed5a0197fa3.blob?X-Amz-Expires=300&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEAoaDmFwLXNvdXRoZWFzdC0yIkcwRQIhAJl5…

  - `documents.filename` (string)
    The name of the file being uploaded.
    Example: Refresh Token and Access Token Usage.pdf

  - `documents.expires` (string)
    Timestamp indicating when the pre-signed URL expires.
    Example: 2025-09-16T14:38:18.7738637+10:00

## Response 400:

  - `400` (unknown)
    Error Message

## Response 400 fields (application/json):

  - `errors` (array)

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `Errors` (array)

  - `Errors.Code` (string)
    Example: API_NOT_AUTHORISED

  - `Errors.Message` (string)
    Example: Not authorised

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `Errors` (array)

  - `Errors.Code` (string)
    Example: FORBIDDEN

  - `Errors.Message` (string)
    Example: You do not have permission to access this resource.

## Response 404:

  - `404` (unknown)
    Resource not available or user does not have access to the fund

## Response 404 fields (application/json):

  - `Errors` (array)

  - `Errors.Code` (string)
    Example: API_NOT_FOUND

  - `Errors.Message` (string)
    Example: Resource not available or user does not have access to the fund.

## Response 500:

  - `500` (unknown)
    Internal Server Error

## Response 500 fields (application/json):

  - `Errors` (array)

  - `Errors.Code` (string)
    Example: API_INTERNAL_ERROR

  - `Errors.Message` (string)
    Example: An unexpected error occurred on the server. Please try again later.

## Response default:

  - `default` (unknown)
    Unexpected error

## Response default fields (application/json):

  - `Errors` (array)

  - `Errors.Code` (string)
    Example: API_INTERNAL_ERROR

  - `Errors.Message` (string)
    Example: An unexpected error occurred on the server. Please try again later.

## Response 400 examples:

  - `Invalid file name` (unknown)

  - `Invalid file size` (unknown)

  - `Invalid content type` (unknown)

