POST
Confirm uploads

Overview

Confirms that the client successfully PUT each presigned object to DigitalOcean Spaces. For every fileKey the server:
  1. Verifies the key prefix matches the caller (tenancy-docs/{userId}/... or listings/{userId}/...) — otherwise 403 FORBIDDEN.
  2. HEADs the object in storage to confirm presence and read Content-Length/Content-Type.
  3. Cross-checks the stored Content-Type against the extension-implied MIME — if they disagree, 400 VALIDATION_FAILED. (The full byte-level magic-bytes sniff lands with the Phase 7 image worker — until then the presign-time Content-Type pin and this cross-check are the spoof defence.)
  4. Inserts a row into the uploads collection.
  5. For HOME_PHOTO keys, enqueues an image.process BullMQ job (Phase 7 will run the worker — resize variants, EXIF GPS strip, blurhash).
  6. Returns { uploadId, fileKey, cdnUrl }. cdnUrl is null for TENANCY_DOC (private bucket; admins fetch via a separate signed-download endpoint).
The returned uploadId is what onboarding and current-home endpoints reference (uploadId, photoUploadIds).

Authentication

Bearer <accessToken> required. Scope: user.

Path parameters

None.

Query parameters

None.

Request body

Example payload

Response — 200 OK

ConfirmedFile object

Example response

Error responses

Example error — 404

Side effects

  • Inserts one row per fileKey into the uploads collection with userId, fileType (inferred from the key prefix), mimeType (extension-derived), fileSizeBytes, fileKey, and url (CDN URL for HOME_PHOTO, empty string for TENANCY_DOC).
  • For each HOME_PHOTO, enqueues an image.process BullMQ job (Phase 2 records the call; Phase 7 runs the worker — resize, EXIF GPS strip, blurhash).
  • No write happens for any file in the batch if an earlier file fails — failures are surfaced in order.

See also

curl