POST

/Document/File

When to Use

  • Upload binary files to existing document records
  • Store KYC/AML documentation and identification documents
  • Upload trust deeds and constitutional documents
  • Store investment mandates and authority documents
  • Upload generated statements for member portal access

Prerequisites

  • Valid Bearer token with document upload permissions
  • Document Record Requirement: Target document record must exist in the system (validates via GET /Document lookup) - operation returns 400 Bad Request if document not found
  • Product Validation Required: Either ProductID or ExternalProductId must be provided to validate document exists within product scope
  • File must meet format and size requirements (Document, Image, or Import categories as defined in filetypes.json)

Considerations

  • File Security: All files undergo virus scanning before storage
  • Document Association: Files inherit security classification from parent document record
  • Retention Policies: Files automatically inherit retention policies based on document type
  • Upload Format: Use multipart/form-data encoding for file uploads

Description

Uploads binary file content to a document record with upsert behavior: If the document exists, updates the file metadata (name and file path). If the document doesn't exist, creates a new document record with DocumentTypeID=1 (General) and uploads the file.

Dual Operation Mode - Upsert Pattern

  1. Document Lookup: System searches for existing document by DocumentID or ExternalDocumentId within the user's instance scope and validates against provided ProductID
  2. Update Mode (if document exists): Updates document name and file path (Repository\{DocumentID}_{FileName}), preserves all other metadata, assigns UpdatedDate and UpdatedUserID, validates user has access to the document
  3. Create Mode (if document not found): Creates new document record with DocumentTypeID=1 (General), generates file path, and assigns CreatedDate and CreatedUserID. Note: ExternalDocumentId from request is assigned to ExternalProductId field in this scenario
  4. Security Scanning & Validation: Comprehensive file type validation, virus scanning, and content analysis using filetypes.json configuration (Document, Image, and Import categories)
  5. File Storage: Stores file content in encrypted repository storage with path: Repository\{DocumentID}_{FileName}, with automatic backup and geographic redundancy
  6. Audit Trail Creation: Document record updated with file metadata, storage references, and comprehensive audit log entries
Behavioral Note: Unlike traditional POST semantics, this endpoint performs an upsert operation. Use PUT /Document/File for explicit file replacement when you need guaranteed update-only behavior.

Required Headers - See Authentication

HeaderValueDescription
Content-Typemultipart/form-dataRequest content type for file uploads
Authorization{accessToken}Bearer token for API access
Version2.0API version identifier

Request Body (multipart/form-data)

Parameter Type Required Description
DocumentID >
integer
The native 7G identifier for the document record to upload file content to.
ExternalDocumentId >
string
Your external system identifier for the document record to upload file content to.
ProductID >
integer
The product identifier for document validation. Used to verify document exists within the specified product scope before file upload.
ExternalProductId >
string
Your external product identifier. Alternative to ProductID for product-scoped document validation.
file >
binary
The binary file content to upload. Supports various formats depending on document type and system configuration (Document, Image, Import categories).
DocumentID
integer
The native 7G identifier for the document record to upload file content to.
ExternalDocumentId
string
Your external system identifier for the document record to upload file content to.
ProductID
integer
The product identifier for document validation. Used to verify document exists within the specified product scope before file upload.
ExternalProductId
string
Your external product identifier. Alternative to ProductID for product-scoped document validation.
file
binary
The binary file content to upload. Supports various formats depending on document type and system configuration (Document, Image, Import categories).

Example Requests

bash
# Upload file to document by ID
curl -X POST 'https://api.7g.com.au/Document/File' \
  -H "Authorization: {accessToken}" \
  -H "Version: 2.0" \
  -F "ProductID=100" \
  -F "DocumentID=12345" \
  -F "file=@/path/to/investor_statement.pdf"

# Upload file to document by external ID
curl -X POST 'https://api.7g.com.au/Document/File' \
  -H "Authorization: {accessToken}" \
  -H "Version: 2.0" \
  -F "ExternalProductId=GROWTH_FUND_AU" \
  -F "ExternalDocumentId=INV-STMT-2024-001" \
  -F "file=@/path/to/compliance_document.pdf"

Response Examples

json
{
  "result": true,
  "message": "File uploaded successfully",
  "recordCount": 1,
  "data": {
    "documentID": 12345,
    "externalDocumentId": null,
    "documentTypeID": 1,
    "name": "Investor Statement Q4 2024",
    "code": "INV-STMT-Q4-2024",
    "description": "Quarterly investment statement",
    "password": null,
    "ordinal": 1,
    "productID": 100,
    "externalProductId": null,
    "bizEntityID": 5678,
    "externalBizEntityId": null,
    "organisationID": null,
    "externalOrganisationId": null,
    "showInDocumentsInPortal": true,
    "isPublic": false
  }
}