# Upload client document

Multipart upload of a file for a client. Requires Document Manager **Create/Edit** scoped to the **client** module. Max request size ~25 MB. Optional `Idempotency-Key` header: duplicate key returns HTTP 200 with the existing document. On success, response is `{ success, data }` with `documentId`, `fileName`, and optional `downloadUrl`. On failure, body is `{ errorCode, errorText }` (camelCase with CamelCaseResponse).

Endpoint: POST /v1/documents/clients
Version: 1.0.0
Security: BearerAuth, ApiKeyAuth

## Query parameters:

  - `clientId` (integer, required)
    Client ID.

## Header parameters:

  - `Idempotency-Key` (string)
    Optional idempotency key for safe retries.

## Request fields (multipart/form-data):

  - `file` (string, required)
    File to upload.

  - `documentType` (string, required)
    Document type name (must exist for the client module).

  - `reportTypeId` (integer)
    Optional report type ID.

  - `friendlyName` (string)
    Optional display name.

  - `viewAccess` (string)
    Optional view access flag/value.

## Response 200 fields (application/json):

  - `success` (boolean)

  - `data` (object)
    Payload inside ApiResponse.data for POST/PUT /v1/documents/* upload and update.

  - `data.documentId` (integer)

  - `data.fileName` (string)

  - `data.downloadUrl` (string | null)
    Optional pre-signed URL when available.

  - `error` (string)

## Response 201 fields (application/json):

  - `success` (boolean)

  - `data` (object)
    Payload inside ApiResponse.data for POST/PUT /v1/documents/* upload and update.

  - `data.documentId` (integer)

  - `data.fileName` (string)

  - `data.downloadUrl` (string | null)
    Optional pre-signed URL when available.

  - `error` (string)

## Response 400 fields (application/json):

  - `errorCode` (integer)

  - `errorText` (string)

## Response 413 fields (application/json):

  - `errorCode` (integer)

  - `errorText` (string)

## Response 415 fields (application/json):

  - `errorCode` (integer)

  - `errorText` (string)

## Response 422 fields (application/json):

  - `errorCode` (integer)

  - `errorText` (string)

