---
title: "Get storage targets for a batch"
method: POST
path: "/v1/mailboxes/{mailbox_id}/upload_sessions/{session_id}/uploads"
tags: ["Files"]
---

# Get storage targets for a batch

`POST /v1/mailboxes/{mailbox_id}/upload_sessions/{session_id}/uploads`

## Request

- Base URL: `https://api.revdoku.com`
- URL: `https://api.revdoku.com/v1/mailboxes/{mailbox_id}/upload_sessions/{session_id}/uploads`
- Auth: HTTP bearer

Returns upload.url and upload.headers for each file that needs bytes. Repeating a path returns a fresh target, for example after a failed PUT. Files with identical content are skipped.

## Path parameters

- `mailbox_id` string, required
- `session_id` string, required

## Request body

- object
  - `files` UploadSessionFile[], required
    - `path` string, required: Destination path in the mailbox. Paths under _email/ return EMAIL_PATH_READ_ONLY.
    - `byte_size` integer, required
    - `content_type` string, required
    - `checksum` string, required: Base64-encoded MD5 of the bytes.
    - `sha256` string, required: Hex SHA-256 of the bytes.
  - `account_id` string: Select another granted account for this request.
  - `reason` string, nullable: Optional purpose for this action. AI agents should explain intentional reads and changes when known; omit when unknown. Do not include secrets, file contents, or transcripts.

## Response `201`

Created

- object
  - `success` true, required
  - `data` UploadSessionResult, required
    - `mailbox_upload_session` UploadSession, required
      - `id` string, required
      - `mailbox_id` string, required
      - `status` 'pending' | 'finalized' | 'expired' | 'failed', required: pending accepts uploads. failed means canceled; its unsaved files were discarded.
      - `base_mailbox_version_id` string, nullable: Mailbox version when the session started.
      - `target_mailbox_version_id` string, nullable: Mailbox version created by the final save.
      - `uploads_expire_at` string, date-time, nullable: Unsaved uploads are discarded after this time.
      - `session_closed_at` string, date-time, nullable
      - `files_count` integer
      - `pending_files_count` integer
      - `uploaded_files_count` integer
      - `finalized_files_count` integer
      - `skipped_files_count` integer
      - `skipped_code_counts` object: Skipped files per skip code.
      - `failed_files_count` integer
    - `uploads` UploadSessionUpload[]: Create and uploads only: storage targets for the files that need bytes.
      - `input_index` integer
      - `path` string, required
      - `name` string
      - `signed_blob_id` string
      - `upload` StorageUpload, required
        - `url` string, uri, required
        - `headers` object, required
    - `uploaded` UploadedFile[], required: Files saved by this request (at most 250).
      - `input_index` integer
      - `path` string, required
      - `file` MailboxFile, required
        - `id` string, required
        - `mailbox_id` string
        - `basename` string
        - `path` string, required
        - `role` string
        - `created_by_system` string
        - `deleted` boolean
        - `version_reasons` FileVersionReason[]
          - `version_id` string
          - `reason` string
          - `created_by_id` string
          - `version_number` integer
          - `created_at` string, date-time
        - `lock` object
        - `current_file_version` FileVersion
          - `id` string, required
          - `file_id` string, required
          - `name` string
          - `mime_type` string
          - `sha256` string
          - `reason` string, nullable
          - `created_by_system` string
          - `deleted` boolean: True for the version that records a deletion.
          - `ready` boolean
          - `has_text` boolean
          - `version_number` integer, required
          - `byte_size` integer
          - `created_at` string, date-time
          - `created_by` FileActor
            - `id` string
            - `name` string
            - `email` string
          - `updated_by` FileActor
            - `id` string
            - `name` string
            - `email` string
          - `created_by_agent` object
          - `updated_by_agent` object
          - `created_by_api_key` object
          - `updated_by_api_key` object
          - `read` boolean
          - `read_at` string, date-time, nullable
          - `read_by` FileActor
            - `id` string
            - `name` string
            - `email` string
          - `read_by_api_key` FileKey
            - `id` string
            - `label` string
            - `token_type` string
        - `created_by` FileActor
          - `id` string
          - `name` string
          - `email` string
        - `created_at` string, date-time
        - `updated_at` string, date-time
        - `deleted_at` string, date-time
        - `created_by_agent` object
        - `updated_by_agent` object
        - `created_by_api_key` object
        - `updated_by_api_key` object
        - `read` boolean
        - `read_at` string, date-time, nullable
        - `read_by` FileActor
          - `id` string
          - `name` string
          - `email` string
        - `read_by_api_key` FileKey
          - `id` string
          - `label` string
          - `token_type` string
      - `version` FileVersion, required
        - `id` string, required
        - `file_id` string, required
        - `name` string
        - `mime_type` string
        - `sha256` string
        - `reason` string, nullable
        - `created_by_system` string
        - `deleted` boolean: True for the version that records a deletion.
        - `ready` boolean
        - `has_text` boolean
        - `version_number` integer, required
        - `byte_size` integer
        - `created_at` string, date-time
        - `created_by` FileActor
          - `id` string
          - `name` string
          - `email` string
        - `updated_by` FileActor
          - `id` string
          - `name` string
          - `email` string
        - `created_by_agent` object
        - `updated_by_agent` object
        - `created_by_api_key` object
        - `updated_by_api_key` object
        - `read` boolean
        - `read_at` string, date-time, nullable
        - `read_by` FileActor
          - `id` string
          - `name` string
          - `email` string
        - `read_by_api_key` FileKey
          - `id` string
          - `label` string
          - `token_type` string
      - `created` boolean, required: False when the path received a new version.
    - `uploaded_count` integer, required
    - `uploaded_truncated` boolean
    - `created_count` integer
    - `updated_count` integer
    - `skipped` FileUploadSkip[], required: Files left unchanged, for example identical content (DUPLICATE_FILE_VERSION).
      - `path` string
      - `name` string
      - `reason` string
      - `code` string
      - `input_index` integer
      - `details` object
    - `skipped_count` integer, required
    - `skipped_truncated` boolean
    - `finalize_pending` boolean: Finalize only: true when more files remain. Call finalize again after Retry-After.
    - `remaining_files_count` integer
    - `message` string

## Other responses

- `default`: Request failed. See error.code. Any 429 or 503 response with Retry-After (for example 503 EMAIL_LABELING_PENDING or 503 EMAIL_INDEX_BUILDING): wait that many seconds, then try the read again. 429 EMAIL_SEND_RATE_LIMITED has no Retry-After. Never retry EMAIL_LOOP_DETECTED.

---

[API](https://skmtc.dev/revdoku/apis/revdoku-api.md) · [All operations](https://skmtc.dev/revdoku/apis/revdoku-api/llms.txt) · [OpenAPI document](https://skmtc.dev/revdoku/apis/revdoku-api/revisions/3ff4e2540a8b?raw)
