> ## Documentation Index
> Fetch the complete documentation index at: https://developers.opereit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Confirm document upload

> After uploading the file(s) to their `upload_url`, call this to confirm the upload went through. Returns a per-document result so you know exactly which ones succeeded and why any others failed. See [Uploading a document for an existing claim](/guides/claim-documents).



## OpenAPI

````yaml POST /v1/claims/{id}/documents/complete
openapi: 3.1.0
info:
  title: Opereit API
  description: >-
    Public API for Opereit. Create and track carrier claims, upload carrier
    contracts, run audits against incoming carrier invoices, and retrieve line
    items and findings.
  version: 1.0.0
servers:
  - url: https://api.opereit.ai
    description: Production
security:
  - apiKey: []
paths:
  /v1/claims/{id}/documents/complete:
    post:
      summary: Confirm a document upload
      description: >-
        After uploading the file(s) to their `upload_url`, call this to confirm
        the upload went through. Returns a per-document result so you know
        exactly which ones succeeded and why any others failed. See [Uploading a
        document for an existing claim](/guides/claim-documents).
      operationId: completeClaimDocumentUpload
      parameters:
        - $ref: '#/components/parameters/ClaimId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompleteDocumentUploadRequest'
      responses:
        '200':
          description: Per-document confirm results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompleteDocumentUploadResponse'
        '400':
          $ref: '#/components/responses/ClaimDocumentIdsInvalidBody'
        '401':
          $ref: '#/components/responses/ClaimUnauthorized'
        '404':
          $ref: '#/components/responses/ClaimNotFound'
        '500':
          $ref: '#/components/responses/ClaimInternalError'
components:
  parameters:
    ClaimId:
      name: id
      in: path
      required: true
      description: ID of the claim.
      schema:
        type: string
  schemas:
    CompleteDocumentUploadRequest:
      type: object
      required:
        - document_ids
      properties:
        document_ids:
          type: array
          minItems: 1
          maxItems: 10
          items:
            type: string
            maxLength: 64
          description: >-
            IDs returned by the initiate-upload endpoint, for the files you've
            now uploaded to their `upload_url`. Up to 10 per request.
    CompleteDocumentUploadResponse:
      type: object
      required:
        - attached
        - documents
      properties:
        attached:
          type: integer
          description: Count of documents that were successfully confirmed.
        documents:
          type: array
          items:
            $ref: '#/components/schemas/ConfirmDocumentResult'
          description: One result per document ID you sent, in the same order.
    ConfirmDocumentResult:
      type: object
      description: >-
        The confirm outcome for one document. See [Confirm
        results](/guides/claim-documents#confirm-results).
      required:
        - id
        - status
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - confirmed
            - failed
        reason:
          $ref: '#/components/schemas/ConfirmDocumentReason'
    ApiError:
      type: object
      description: Error envelope returned by every endpoint.
      required:
        - statusCode
        - statusReasonCode
        - error
      properties:
        statusCode:
          type: integer
          description: HTTP status code — same value as the response status.
        statusReasonCode:
          type: string
          enum:
            - INVALID_REQUEST_BODY
            - INVALID_QUERY_PARAMETERS
            - UNSUPPORTED_DOCUMENT_CONTENT_TYPE
            - CLAIM_NOT_FOUND
            - CLAIM_ALREADY_EXISTS
            - CONTRACT_NOT_FOUND
            - INVOICE_AUDIT_NOT_FOUND
            - INTERNAL_ERROR
            - AUTHENTICATION_REQUIRED
            - INVALID_CREDENTIALS_FORMAT
            - INVALID_CREDENTIALS_ENCODING
            - INVALID_CREDENTIALS
          description: Machine-readable error code.
        error:
          type: string
          description: Human-readable error message.
        details:
          type: object
          description: >-
            Present on `400` responses. `formErrors` holds errors not tied to a
            specific field; `fieldErrors` maps a top-level request field to the
            list of validation messages raised under it.
          properties:
            formErrors:
              type: array
              items:
                type: string
            fieldErrors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
    ConfirmDocumentReason:
      type: string
      enum:
        - document_not_found
        - storage_check_failed
        - not_found_in_storage
        - invalid_size
        - unsupported_content_type
        - internal_error
      description: >-
        Why a document failed to confirm. Only present when that document's
        `status` is `failed`.


        - `document_not_found`: no document with that ID exists on this claim.

        - `storage_check_failed`: Opereit couldn't verify whether the file was
        received. Transient — safe to retry.

        - `not_found_in_storage`: the file was never actually uploaded to
        `upload_url`.

        - `invalid_size`: the uploaded file is missing a readable size, or is
        bigger than 10 MB.

        - `unsupported_content_type`: the uploaded file's content type isn't one
        of the accepted types.

        - `internal_error`: something went wrong on Opereit's end while
        confirming this document. Safe to retry.


        See [Confirm results](/guides/claim-documents#confirm-results).
  responses:
    ClaimDocumentIdsInvalidBody:
      description: >-
        `document_ids` is missing, empty, has more than 10 entries, or contains
        an ID longer than 64 characters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            statusCode: 400
            statusReasonCode: INVALID_REQUEST_BODY
            error: Invalid request body
            details:
              formErrors: []
              fieldErrors:
                document_ids:
                  - At least one document is required
    ClaimUnauthorized:
      description: >-
        Authentication is missing or invalid. Also returned as
        `WWW-Authenticate: Basic realm="Opereit API"` on the response headers.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            statusCode: 401
            statusReasonCode: AUTHENTICATION_REQUIRED
            error: Authentication required
    ClaimNotFound:
      description: The claim does not exist, or belongs to a different organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            statusCode: 404
            statusReasonCode: CLAIM_NOT_FOUND
            error: Claim not found
    ClaimInternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            statusCode: 500
            statusReasonCode: INTERNAL_ERROR
            error: Internal server error
  securitySchemes:
    apiKey:
      type: http
      scheme: basic
      description: >-
        HTTP Basic Auth using your API key. Send `Authorization: Basic
        base64(key_id:key_secret)`.

````