# Verify and publish staged R2 uploads

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

Promote verified staging objects before a manifest may reference them.

Scope is derived exclusively from the authenticated account. A client can
present an opaque staging handle, but cannot finalize another tenant's
staging namespace or choose a publication scope.

- 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` `FinalizeUploadBatchBody`

## Responses

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

## Schemas

```yaml
FinalizeUploadBatchBody:
  properties:
    uploads:
      items:
        $ref: "#/components/schemas/StagedUploadBody"
      type: array
      minItems: 1
  additionalProperties: false
  type: object
  required:
    - uploads
  title: FinalizeUploadBatchBody
StagedUploadBody:
  properties:
    staging_id:
      type: string
      pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
    blob_id:
      type: string
      pattern: ^[0-9a-f]{64}$
    content_length:
      type: integer
      minimum: 1
  additionalProperties: false
  type: object
  required:
    - staging_id
    - blob_id
    - content_length
  title: StagedUploadBody
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
```
