> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canary.effectiveai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Confirm a file upload to an underwriting submission

> Saves an uploaded file as one of the submission's documents and returns it, as `listUnderwritingSubmissionDocuments` lists it. Where the workspace turns on extraction on arrival for the submission's program, it also starts one (keyed by the upload, so a retry starts nothing new), unless the submission is bound, declined or closed; a start that cannot run now does not fail the upload.

Retrying the same token before it expires confirms the same document (a later PUT to the same URL replaces its bytes). Bytes that were never uploaded are 409 `upload_incomplete`: PUT them and complete again. An overlapping completion of the same token is 409 `conflict`: retry it. Bytes that do not match `sizeBytes` or the file's type are 400 `invalid_upload_content`: start a new upload. An invalid or expired token is 400 `invalid_request`.

Needs edit access to the submission (403 for a reader, 404 when it cannot be read). Only where the workspace has underwriting turned on (403 `feature_not_enabled`).

Alpha: this operation may change or be removed without notice.



## OpenAPI

````yaml /openapi.json post /insurance/underwriting/submissions/{submissionId}/uploads/complete
openapi: 3.0.3
info:
  title: Effective API
  version: 2.0.0
  description: The public Effective REST API. Authenticate using an Effective API key.
servers:
  - url: https://api.canary.effectiveai.app/api/v2
    description: Canary
security:
  - bearerAuth: []
paths:
  /insurance/underwriting/submissions/{submissionId}/uploads/complete:
    post:
      tags:
        - Underwriting submissions
      summary: Confirm a file upload to an underwriting submission
      description: >-
        Saves an uploaded file as one of the submission's documents and returns
        it, as `listUnderwritingSubmissionDocuments` lists it. Where the
        workspace turns on extraction on arrival for the submission's program,
        it also starts one (keyed by the upload, so a retry starts nothing new),
        unless the submission is bound, declined or closed; a start that cannot
        run now does not fail the upload.


        Retrying the same token before it expires confirms the same document (a
        later PUT to the same URL replaces its bytes). Bytes that were never
        uploaded are 409 `upload_incomplete`: PUT them and complete again. An
        overlapping completion of the same token is 409 `conflict`: retry it.
        Bytes that do not match `sizeBytes` or the file's type are 400
        `invalid_upload_content`: start a new upload. An invalid or expired
        token is 400 `invalid_request`.


        Needs edit access to the submission (403 for a reader, 404 when it
        cannot be read). Only where the workspace has underwriting turned on
        (403 `feature_not_enabled`).


        Alpha: this operation may change or be removed without notice.
      operationId: completeUnderwritingSubmissionUpload
      parameters:
        - schema:
            type: string
            format: uuid
            description: The submission’s id.
          required: true
          description: The submission’s id.
          name: submissionId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/V2CompleteUnderwritingSubmissionUploadRequest
      responses:
        '200':
          description: The document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2UnderwritingSubmissionDocument'
        '400':
          description: >-
            invalid_upload_content: the bytes do not match sizeBytes or the file
            type; start a new upload. invalid_request: an invalid or expired
            token, or an unknown field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '403':
          description: >-
            feature_not_enabled: underwriting is not enabled for the workspace.
            forbidden: the caller can read the submission and not edit it, or
            the credential may not write.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '404':
          description: 'not_found: no such submission, or the caller cannot read it.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '409':
          description: >-
            upload_incomplete: the bytes were never uploaded. conflict: another
            completion of the token is in progress; retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '413':
          description: 'request_too_large: the body is over 32 KiB.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '415':
          description: 'unsupported_media_type: use application/json.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
      security:
        - bearerAuth: []
components:
  schemas:
    V2CompleteUnderwritingSubmissionUploadRequest:
      type: object
      properties:
        uploadToken:
          type: string
          minLength: 1
          maxLength: 16384
          description: >-
            Opaque upload token. Return it unchanged to
            `completeUnderwritingSubmissionUpload` for this submission within
            one hour.
      required:
        - uploadToken
      additionalProperties: false
    V2UnderwritingSubmissionDocument:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: >-
            Artifact id: read it with `getArtifact`, its text with
            `getArtifactText`.
        name:
          type: string
          minLength: 1
        mimeType:
          type: string
          minLength: 1
        sizeBytes:
          type: integer
          minimum: 0
        versionId:
          type: string
          nullable: true
          description: >-
            The version listed, so a result can pin it; null for a legacy
            artifact.
        sha256:
          type: string
          nullable: true
          description: >-
            The listed version’s SHA-256, 64 lowercase hex digits; null when not
            recorded.
        folder:
          type: object
          nullable: true
          properties:
            key:
              type: string
              minLength: 1
              description: 'Opaque: the document type the folder collects.'
            label:
              type: string
              minLength: 1
          required:
            - key
            - label
          description: >-
            The smart folder the document sorts into, such as Broker submission;
            null when none.
        source:
          type: object
          properties:
            kind:
              type: string
              minLength: 1
              description: >-
                Extensible: `upload`, `email` (or a message’s other channel) or
                `web`.
            messageId:
              type: string
              description: >-
                The message it came with: its channel’s own id, such as an
                email’s Message-ID.
            part:
              type: string
              description: >-
                Which part of that message: `message`, `attachment:<n>` or
                `document:<n>`.
            originalFilename:
              type: string
              description: The filename as the message named it.
          required:
            - kind
          description: How the document reached the submission.
        addedBy:
          type: object
          properties:
            type:
              type: string
              enum:
                - user
                - system
            id:
              type: string
              minLength: 1
          required:
            - type
            - id
          description: A user, or `system` for email intake.
        addedAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - mimeType
        - sizeBytes
        - versionId
        - sha256
        - folder
        - source
        - addedBy
        - addedAt
    V2CodedError:
      allOf:
        - $ref: '#/components/schemas/V2Error'
        - type: object
          properties:
            code:
              type: string
              minLength: 1
              description: Stable error code. Clients must tolerate unknown future codes.
            details:
              type: array
              items:
                type: object
                properties:
                  location:
                    type: string
                    enum:
                      - path
                      - query
                      - header
                      - body
                  path:
                    type: array
                    items:
                      type: string
                      maxLength: 64
                    maxItems: 12
                  code:
                    type: string
                    enum:
                      - required
                      - invalid_type
                      - invalid_value
                      - unknown_field
                  message:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - location
                  - path
                  - code
                  - message
              minItems: 1
              maxItems: 20
              description: Bounded safe validation issues; may omit some invalid fields.
            requestId:
              type: string
              minLength: 1
              maxLength: 128
              description: >-
                Existing server correlation for this HTTP attempt, when
                available.
            dataset:
              type: string
              enum:
                - naic
                - osha
              description: Dataset needed for dataset_not_enabled.
            businessCode:
              type: string
              description: The rater’s own refusal code, for business_rejection.
            violations:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    description: Authored or built-in constraint code
                  message:
                    type: string
                    description: Authored message for the failed constraint
                  path:
                    type: string
                    description: Input path of the offending value; empty for the request
                  value:
                    nullable: true
                    description: Offending input value, size-bounded by the runtime
                  constraint:
                    type: string
                    description: The constraint the value failed, as text
                  cite:
                    type: string
                    nullable: true
                    description: >-
                      Filing citation of the constraint, when the source cites
                      one
                required:
                  - code
                  - message
                  - path
                  - value
                  - constraint
                  - cite
                additionalProperties: false
              maxItems: 256
              description: >-
                Each input constraint the submission failed, for invalid_inputs
                and business_rejection.
            violationsTruncated:
              type: boolean
              description: >-
                True when the rater reported more violations than violations
                holds.
            executionId:
              type: string
              description: >-
                The recorded execution of a failed rating, for rater rating
                failures.
            accessUrl:
              type: string
              nullable: true
              format: uri
              description: Not currently returned.
          required:
            - code
    V2Error:
      type: object
      properties:
        error:
          type: string
          minLength: 1
          description: Human-readable explanation of the failure.
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Effective API key. Send Authorization: Bearer sk-eai-...'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.