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

# Fill a library template's draft

> Starts a library template's draft for an account, or revises one. The first fill names the template and the account, admitted under the caller's scope; the draft starts from the template's fixed values and the known values the account's records hold, read as the caller, and the values sent apply over them, each with its source. A revision sends only what changes. The answer is the draft as its card shows it, what applied, what filled itself, where the values came from and the problems; named policies that match none answer policy_not_found with the account's policies. dry_run computes the same answer and saves nothing. Nothing is filed or sent.



## OpenAPI

````yaml /openapi.generated.json post /documents/template-drafts/{id}/fill
openapi: 3.1.0
info:
  description: >-
    Public API reference. Generated from apps/engine/openapi.yaml by make
    docs-openapi-write. Do not edit.
  title: Nexio platform API
  version: '1'
servers:
  - url: https://api.usenexio.com
security: []
tags:
  - name: Access
  - name: Catalog
  - name: Conversations
  - name: Documents
  - name: Engines
  - name: Events
  - name: Feedback
  - name: Graph
  - name: Records
  - name: Roadmap
  - name: Runs
  - name: Webhooks
  - name: accounts
  - name: actions
  - name: activities
  - name: activity-feed
  - name: attachments
  - name: audit
  - name: benefit-plans
  - name: billing-transactions
  - name: carrier_documents
  - name: certificate-holders
  - name: certificate_drafts
  - name: certificates
  - name: change_feed
  - name: claims
  - name: classes
  - name: codes
  - name: commission_facts
  - name: connections
  - name: contacts
  - name: contingencies
  - name: conversations
  - name: customer
  - name: customer_contacts
  - name: deals
  - name: dependents
  - name: document_extractions
  - name: documents
  - name: drivers
  - name: eforms
  - name: employees
  - name: events
  - name: feature_requests
  - name: form-templates
  - name: invoices
  - name: leads
  - name: line_schedules_other
  - name: loss_history
  - name: machines
  - name: markets
  - name: motor-carriers
  - name: notes
  - name: opportunities
  - name: opportunity-signals
  - name: pages
  - name: personal_lines_detail
  - name: placement_choices
  - name: placement_feedback
  - name: placements
  - name: policies
  - name: policy_parties
  - name: policy_personnel
  - name: policy_transactions
  - name: premium_rows
  - name: procedures
  - name: proposals
  - name: quote_comparisons
  - name: quotes
  - name: records
  - name: register-views
  - name: renewal-entries
  - name: risk_review_choices
  - name: rollups
  - name: seats
  - name: sec-filings
  - name: service_agreements
  - name: submissions
  - name: suspenses
  - name: tasks
  - name: umbrella_underlying
  - name: underwriting_questions
  - name: uploaded_documents
  - name: vehicles
  - name: workflows
paths:
  /documents/template-drafts/{id}/fill:
    post:
      tags:
        - Documents
      summary: Fill a library template's draft
      description: >-
        Starts a library template's draft for an account, or revises one. The
        first fill names the template and the account, admitted under the
        caller's scope; the draft starts from the template's fixed values and
        the known values the account's records hold, read as the caller, and the
        values sent apply over them, each with its source. A revision sends only
        what changes. The answer is the draft as its card shows it, what
        applied, what filled itself, where the values came from and the
        problems; named policies that match none answer policy_not_found with
        the account's policies. dry_run computes the same answer and saves
        nothing. Nothing is filed or sent.
      operationId: fillDocumentTemplateDraft
      parameters:
        - description: >-
            The draft id. The first fill creates the draft under this id; it is
            1 to 200 letters, digits, '_', '.', ':' or '-'.
          in: path
          name: id
          required: true
          schema:
            description: >-
              The draft id. The first fill creates the draft under this id; it
              is 1 to 200 letters, digits, '_', '.', ':' or '-'.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateFillRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentTemplateFillJSON'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Not Found
        '412':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Precondition Failed
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Request Entity Too Large
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Internal Server Error
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Service Unavailable
      security:
        - bearer: []
components:
  schemas:
    TemplateFillRequest:
      additionalProperties: false
      properties:
        account:
          description: >-
            The account the document is about, admitted under the caller's
            scope. A first fill with no account starts a draft about no account
            on file: it starts from the template's fixed values, and only the
            seat that made it reads, revises or downloads it. On a revision of
            that seat draft, an account moves the draft onto it, admitted and
            read as a first fill is; a draft already on an account keeps it and
            another is refused.
          type: string
        comparison:
          description: >-
            A saved quote comparison on the account (its id, as quote comparison
            answers it), read as the caller. On the first fill of a proposal its
            quote values (carriers, premiums, terms, markets, the premium
            summary) start the draft, each sourced to the quote document or the
            comparison; the values sent fill the rest. A comparison the caller
            cannot read answers comparison_not_found; one on another account, or
            tied to no account and saved by another user,
            comparison_other_account; one that fills no value
            comparison_not_applied, and nothing is saved; on a template of one
            quote per line, several quotes for a line with no carrier sent
            answer comparison_options with the lines, and nothing is saved; on a
            new Renewal Proposal, one quote that renews no policy the account
            holds answers comparison_new_business, and nothing is saved. The
            answer's comparison names how many values it filled and its gaps (a
            premium no template line takes, a line with no carrier chosen). On a
            revision it starts the same draft again from the account and this
            comparison: the earlier quotes' values go, the values the producer
            wrote or the Assistant derived stay unless sent again, and the draft
            keeps its sections.
          maxLength: 200
          type: string
        dry_run:
          description: Compute the fill and answer it without saving the draft.
          type: boolean
        order_sections:
          description: >-
            Sections in the order they print, by id or title: the ones named
            lead in that order and the rest follow in the draft's order. A
            template of fixed pages moves the whole page a named part is on.
          items:
            type: string
          maxItems: 60
          type:
            - array
            - 'null'
        policy_numbers:
          description: >-
            Policy numbers the producer named. On a first fill or revision, the
            account's own matching policies select the known values; none
            matching answers policy_not_found without changing the draft.
          items:
            type: string
          maxItems: 10
          type:
            - array
            - 'null'
        preset:
          description: >-
            A starting point of the template, by id or name (the Renewal
            Proposal's Brief, Standard, Full or Short; the Commercial and
            Personal Proposal's Short or Full): the draft prints the sections it
            keeps. Remove and restore sections apply after it. A template
            without that starting point is refused with the ones it has.
          maxLength: 60
          type: string
        remove_sections:
          description: Sections to take out, by id or title.
          items:
            type: string
          maxItems: 60
          type:
            - array
            - 'null'
        restore_sections:
          description: Sections to put back, by id or title.
          items:
            type: string
          maxItems: 60
          type:
            - array
            - 'null'
        template:
          description: >-
            The library template id (template.list). Required on the first fill,
            which creates the draft.
          type: string
        values:
          description: >-
            The values to apply, each with its source. A value the template
            cannot take comes back in problems and the rest apply.
          items:
            $ref: '#/components/schemas/DocumentFillEntry'
          type:
            - array
            - 'null'
      required:
        - values
      type: object
    DocumentTemplateFillJSON:
      additionalProperties: false
      properties:
        data: {}
      required:
        - data
      type: object
    Problem:
      additionalProperties: false
      properties:
        code:
          description: >-
            The stable machine-readable error code, UPPER_SNAKE_CASE, one
            meaning forever.
          enum:
            - INVALID_ARGUMENT
            - UNAUTHENTICATED
            - CAPABILITY_DENIED
            - NOT_VISIBLE_OR_ABSENT
            - IDEMPOTENT_REQUEST_IN_FLIGHT
            - ETAG_MISMATCH
            - VALIDATION_FAILED
            - IDEMPOTENCY_KEY_PAYLOAD_MISMATCH
            - SOURCE_UNAVAILABLE
            - RATE_LIMITED
            - INTERNAL
            - DEADLINE_EXCEEDED
            - UNAVAILABLE
            - CLIENT_CLOSED_REQUEST
          type: string
        detail:
          description: A human-readable sentence about this occurrence.
          type: string
        details:
          description: >-
            Structured detail for the reason (for example which owner selection
            rule failed). A Records refusal names its reason code in
            details.reason; a projection refusal (SOURCE_UNAVAILABLE) also names
            its closed subtype in details.subtype (admission_pending, no_build,
            binding_changed, agency_admission_unbounded,
            authority_coordinates_changed, guard_absent, derivation_unaccepted),
            and only admission_pending, which clears by itself, also carries
            details.retry_after_ms, equal to retry_after_ms and the Retry-After
            header.
        errors:
          description: Each invalid parameter, for INVALID_ARGUMENT.
          items:
            $ref: '#/components/schemas/ProblemError'
          type:
            - array
            - 'null'
        instance:
          description: The request path this occurrence answered.
          type: string
        reason:
          description: >-
            The finer cause within the code, UPPER_SNAKE_CASE (for example
            SCOPE_UNAVAILABLE under CAPABILITY_DENIED).
          type: string
        request_id:
          description: The request id, as echoed in the Nexio-Request-Id response header.
          type: string
        retry_after_ms:
          description: When a retry may succeed, the wait before it.
          format: int64
          type: integer
        status:
          description: The HTTP status code.
          format: int64
          type: integer
        title:
          description: The HTTP status phrase.
          type: string
        type:
          description: A URI naming the problem type, derived from the code.
          type: string
      required:
        - type
        - title
        - status
        - code
        - request_id
      type: object
    DocumentFillEntry:
      additionalProperties: false
      properties:
        field:
          type: string
        source:
          $ref: '#/components/schemas/DocumentValueSource'
        value: {}
      required:
        - field
        - value
      type: object
    ProblemError:
      additionalProperties: false
      properties:
        location:
          description: Where the input was, for example query.limit.
          type: string
        message:
          type: string
        value: {}
      required:
        - message
      type: object
    DocumentValueSource:
      additionalProperties: false
      properties:
        from:
          type: string
        ref:
          type: string
      required:
        - from
      type: object
  securitySchemes:
    bearer:
      description: The org's platform API key.
      scheme: bearer
      type: http

````

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