# Upload document

Stores a document linked to an issued disposable certificate. Supported document types: identification evidence, signed contracts (e.g. CA22D), audit logs, identity assertions.
**Note**: if the disposable was issued with `enrollDisposableWitheIDAssertion`, the assertion is stored automatically — do not upload it with this method.
See [uploadDoc](https://docs.namirial.app/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-documents).

Endpoint: POST /api/document/{lraId}/uploadDoc
Version: 26.1.0.3
Security: basicAuth, sslCertificate

## Security:

  - `basicAuth` (unknown)
    http basic

  - `sslCertificate` (unknown)
    mutualTLS

## Path parameters:

  - `lraId` (string, required)
    Local Registration Authority (LRA) identifier.

## Request fields (application/json):

  - `deviceCode` (string, required)
    Device code of the issued certificate, returned by `enroll` (`deviceCode`).
    Example: RHIDP0000000000000

  - `idOtp` (integer)
    OTP certificate identifier returned by `enroll` (`certIdOtp`). Use `0` if the disposable has `otpType=NO_OTP`.
    Example: 1234567

  - `typeDoc` (string, required)
    Type of document to upload.
    Enum: "IDENTIFICATION_DOC", "CONTRACT", "AUDIT_LOG", "IDENTITY_ASSERTION"

  - `extension` (string, required)
    File extension (not case-sensitive). Allowed values: `pdf`, `zip`, `png`, `jpeg`, `jpg`, `docx`, `doc`, `odt`, `xml`, `json`, `txt`, `mp4`, `m4a`, `m4v`.
    Example: pdf

  - `file` (string, required)
    Base64-encoded file content.
    Example: <base64-encoded file>

  - `externalKey` (string)
    Optional external reference key.
    Example: external_key_sample

## Request examples:

  - `Upload a signed contract (PDF)` (unknown)

  - `Upload an identification document (JPEG)` (unknown)

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `deviceCode` (string)
    Device code of the certificate the document is linked to.
    Example: RHIDP0000000000000

  - `filename` (string)
    Server-generated filename for the uploaded document.
    Example: 1234567_a4ece4b3e9626ccfd3bac2eb77c0c1d7950be77e190a64fcf1957279e677ffc7.pdf

  - `typeDoc` (string)
    Type of the uploaded document.
    Enum: "IDENTIFICATION_DOC", "CONTRACT", "AUDIT_LOG", "IDENTITY_ASSERTION"

  - `externalKey` (string | null)
    External reference key, if provided in the request. `null` if not provided.
    Example: external_key_sample

  - `uploadDate` (integer)
    Upload timestamp in epoch milliseconds.
    Example: 1733496805136

## Response 500:

  - `500` (unknown)
    Application error. The backend returns HTTP 500 for all application errors, including validation failures and authentication errors.

## Response 500 fields (application/json):

  - `code` (integer, required)
    Application error code.
    Example: 242

  - `message` (string, required)
    Human-readable error description. For validation errors (code 242), includes field-level details in the format `Input parameter invalid: [{field=..., message=...}]`.
    Example: Input parameter invalid: [{field=disposableHolder, message=must not be null}]

## Response 200 examples:

  - `Document uploaded successfully` (unknown)

## Response 500 examples:

  - `Missing required fields (code 242)` (unknown)

  - `Invalid typeDoc value (code 242)` (unknown)

  - `Invalid extension value (code 242)` (unknown)

  - `Invalid deviceCode (code 85)` (unknown)

  - `Document already uploaded (code 1027)` (unknown)

  - `Authentication or authorization error (code 11002)` (unknown)

