Skip to content

Finalize a file upload

Request

Validate the uploaded bytes (content-type allowlist, size, and magic-byte format) and return the file at status CLEAN or REJECTED. A rejected file is not referenceable and its bytes are removed. Finalizing a file again returns it unchanged.

Security
PartnerApiKey and PartnerOAuth
Path
fileIdinteger, (int64)required

File id

Example:5501
accountIdinteger, (int64)required

Account identifier

curl -i -X POST \
  'https://api-docs.lobbie.com/_mock/openapi/partner/v2/account/{accountId}/file/5501/finalize' \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'x-api-key: YOUR_API_KEY_HERE'

Responses

File finalized (CLEAN or REJECTED)

Bodyapplication/json
contentTypestring

MIME content type

Example:"application/pdf"
createdAtstring, (date-time)

Creation timestamp (UTC)

Example:"2025-01-15T14:00:00Z"
fileNamestring

Original file name

Example:"requisition-9001.pdf"
idinteger, (int64)

File id

Example:5501
kindstring

What a partner-uploaded document is, which fixes its content-type allowlist, size cap, and retention policy. LAB_REQUISITION_PDF: the requisition the partner attaches when it accepts an order. LAB_REPORT_PDF: a result report the partner attaches when it delivers results.

Enum:"LAB_REQUISITION_PDF""LAB_REPORT_PDF"
Example:"LAB_REQUISITION_PDF"
rejectionCodestring

Machine-readable rejection code, present only when status is REJECTED

Example:"FORMAT_MISMATCH"
sizeBytesinteger or null, (int64)

Size of the stored file in bytes, as S3 reports it; null until finalize has seen the bytes

Example:482113
statusstring

Lifecycle status of an uploaded file. PENDING: the upload slot exists and the presigned URL was issued, but the bytes have not been finalized yet, so the file cannot be referenced. CLEAN: the finalized bytes passed validation (content-type allowlist, size, and magic-byte format) and the file may be referenced by an order. The name follows the file-upload framework's terminology and is forward-compatible with the malware scan that framework adds in a later phase; today it means "passed validation, safe to reference". A CLEAN file that is not referenced within 24 hours of finalizing is discarded and reads as not found. REJECTED: the finalized bytes failed validation; the file is not referenceable and its bytes are removed.

Enum:"PENDING""CLEAN""REJECTED"
Example:"CLEAN"
Response
{ "contentType": "application/pdf", "createdAt": "2025-01-15T14:00:00Z", "fileName": "requisition-9001.pdf", "id": 5501, "kind": "LAB_REQUISITION_PDF", "rejectionCode": "FORMAT_MISMATCH", "sizeBytes": 482113, "status": "CLEAN" }