# Presigned R2 PUTs for N xorbs

`POST /v1/datasets/upload/prepare-batch`

Content-addressed batch presign — one round-trip for a whole file's xorbs
(collapses the per-xorb presign cost that otherwise dominates dedup uploads).

- Base URL: `https://junction-api.qualiastudios.dev`
- Authentication: an API key in the `X-API-Key` header, or `Authorization: Bearer …`

## Request body

Required: `application/json` `PrepareUploadBatchBody`

## Responses

- `200` Successful Response: `application/json` `any`
- `401` Invalid or missing API key: `application/json` `ErrorResponse`
- `422` Validation Error: `application/json` `HTTPValidationError`

## Schemas

```yaml
PrepareUploadBatchBody:
  properties:
    blobs:
      items:
        $ref: "#/components/schemas/PrepareUploadObjectBody"
      type: array
      minItems: 1
    ttl_seconds:
      type: integer
      maximum: 3600
      minimum: 60
      default: 300
  additionalProperties: false
  type: object
  required:
    - blobs
  title: PrepareUploadBatchBody
PrepareUploadObjectBody:
  properties:
    blob_id:
      type: string
      pattern: ^[0-9a-f]{64}$
    envelope_sha256:
      type: string
      pattern: ^[0-9a-f]{64}$
    content_length:
      type: integer
      minimum: 1
    resume_staging_id:
      pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
      type:
        - string
        - "null"
  additionalProperties: false
  type: object
  required:
    - blob_id
    - envelope_sha256
    - content_length
  title: PrepareUploadObjectBody
ErrorResponse:
  properties:
    detail:
      type: string
      description: Error message describing what went wrong
  type: object
  required:
    - detail
  title: ErrorResponse
  description: Standard error response.
HTTPValidationError:
  properties:
    detail:
      items:
        $ref: "#/components/schemas/ValidationError"
      type: array
  type: object
  title: HTTPValidationError
ValidationError:
  properties:
    loc:
      items:
        type:
          - string
          - integer
      type: array
      title: Location
    msg:
      type: string
      title: Message
    type:
      type: string
      title: Error Type
    input: {}
    ctx:
      type: object
      title: Context
  type: object
  required:
    - loc
    - msg
    - type
  title: ValidationError
```
