> ## 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.

# Add files to an underwriting submission

> Adds files to a submission's documents in one call: send them as `multipart/form-data`, one part named `file` per file, each with its filename and type. At most 20 files and 25 MiB together; upload a larger file with `createUnderwritingSubmissionUpload`. The files land in the submission's Broker submission folder, as an upload's do. An email's `.eml` added here is a document; add it with `addUnderwritingSubmissionMessage` to have its body and attachments read as the email's.

Where the workspace turns on extraction on arrival for the submission's program (the default), the files start an extraction of every document, or join the one waiting: `extraction` says which, or why none started (`log_final` on a bound, declined or closed submission). Read the submission until `stage` leaves `extracting`, or wait for the `underwriting_submission.extraction.completed` webhook.

Idempotency-Key is required. Each file's document id derives from the key and the file's place in the request, so a retry with the same key and files adds nothing and answers the same documents; the same key with other files is 409 `idempotency_conflict`. A file the file store refuses is listed in `rejected` and the rest are kept.

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}/documents
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}/documents:
    post:
      tags:
        - Underwriting submissions
      summary: Add files to an underwriting submission
      description: >-
        Adds files to a submission's documents in one call: send them as
        `multipart/form-data`, one part named `file` per file, each with its
        filename and type. At most 20 files and 25 MiB together; upload a larger
        file with `createUnderwritingSubmissionUpload`. The files land in the
        submission's Broker submission folder, as an upload's do. An email's
        `.eml` added here is a document; add it with
        `addUnderwritingSubmissionMessage` to have its body and attachments read
        as the email's.


        Where the workspace turns on extraction on arrival for the submission's
        program (the default), the files start an extraction of every document,
        or join the one waiting: `extraction` says which, or why none started
        (`log_final` on a bound, declined or closed submission). Read the
        submission until `stage` leaves `extracting`, or wait for the
        `underwriting_submission.extraction.completed` webhook.


        Idempotency-Key is required. Each file's document id derives from the
        key and the file's place in the request, so a retry with the same key
        and files adds nothing and answers the same documents; the same key with
        other files is 409 `idempotency_conflict`. A file the file store refuses
        is listed in `rejected` and the rest are kept.


        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: addUnderwritingSubmissionDocuments
      parameters:
        - schema:
            type: string
            format: uuid
            description: The submission’s id.
          required: true
          description: The submission’s id.
          name: submissionId
          in: path
        - schema:
            type: string
            minLength: 1
            maxLength: 128
            pattern: ^[A-Za-z0-9\-_.:]+$
            description: >-
              Client-chosen key for safe retries: 1-128 letters, digits, -, _, .
              or :. Use a new random UUID for each intended operation and the
              same key when retrying it. Do not put customer data or credentials
              in the key.
          required: true
          description: >-
            Client-chosen key for safe retries: 1-128 letters, digits, -, _, .
            or :. Use a new random UUID for each intended operation and the same
            key when retrying it. Do not put customer data or credentials in the
            key.
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/V2AddUnderwritingSubmissionDocumentsRequest'
      responses:
        '200':
          description: The documents added, and the extraction they started.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AddedUnderwritingSubmissionDocuments'
        '400':
          description: 'invalid_request: an unknown or invalid field, or submission id.'
          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: 'idempotency_conflict: the key was used with other files.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '413':
          description: 'request_too_large: the files are over 25 MiB together.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '415':
          description: 'unsupported_media_type: use multipart/form-data.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
      security:
        - bearerAuth: []
components:
  schemas:
    V2AddUnderwritingSubmissionDocumentsRequest:
      type: object
      properties:
        file:
          type: array
          items:
            type: string
            format: binary
          description: One part per file, each named `file`, at most 20.
      required:
        - file
    V2AddedUnderwritingSubmissionDocuments:
      type: object
      properties:
        documents:
          type: array
          items:
            $ref: '#/components/schemas/V2UnderwritingSubmissionDocument'
        rejected:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              reason:
                type: string
            required:
              - name
              - reason
          description: Each file the file store refused, by its name. The rest are kept.
        extraction:
          type: object
          properties:
            status:
              type: string
              minLength: 1
              description: >-
                Extensible: `started` (or joined the one waiting), `skipped`
                with `reason`, or `failed` with `code`.
            extractionId:
              type: string
              format: uuid
            reason:
              type: string
              description: >-
                Why none started: `auto_off` (the workspace turns extraction on
                arrival off for the program), `extraction_not_configured`,
                `no_documents`, `log_final` (the submission is bound, declined
                or closed).
            code:
              type: string
            message:
              type: string
          required:
            - status
      required:
        - documents
        - rejected
        - extraction
    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
    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
    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.