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

# Finalize a collection

> The endpoint finalizes a document collection by creating or updating links for all matched documents and users. Optionally accepts a subset of document IDs to finalize. If no document_ids provided, all recognized documents in the collection will be finalized.




## OpenAPI

````yaml POST /v1/documents/collections/{collection_id}/finalize/
openapi: 3.0.1
info:
  title: Truv API
  description: Truv API Documentation
  termsOfService: https://www.truv.com/legal/terms-of-use
  contact:
    email: support@truv.com
  version: v1
servers:
  - url: https://prod.truv.com
security:
  - ClientID: []
    AccessKey: []
tags:
  - name: Users
  - name: Bridge Token
  - name: Companies and Data Providers
  - name: Key Management
  - name: Account Links
  - name: Data Refresh
  - name: Customization Templates
  - name: Webhooks
  - name: Orders
  - name: Tasks
  - name: VOIE Reports
  - name: VOA Reports
  - name: Income Insights Reports
  - name: DDS Reports
  - name: Employment
  - name: Identity
  - name: Shifts
  - name: Pay Statements
  - name: Tax Documents
  - name: Parsed Documents
  - name: Reports
  - name: Uploaded Documents
  - name: Bank Accounts
  - name: Bank Statements
  - name: Deposit Switch Reports
  - name: Insurance Reports
  - name: Income Report
  - name: Scoring Attributes
  - name: Accounts
  - name: Transactions
  - name: Recurring Transactions
  - name: Document Collections
paths:
  /v1/documents/collections/{collection_id}/finalize/:
    parameters:
      - name: collection_id
        in: path
        description: Collection ID
        required: true
        schema:
          type: string
        example: a1b2c3d4e5f6478899aabbccddeeff00
    post:
      tags:
        - Document Collections
      summary: Finalize a collection
      description: >
        The endpoint finalizes a document collection by creating or updating
        links for all matched documents and users. Optionally accepts a subset
        of document IDs to finalize. If no document_ids provided, all recognized
        documents in the collection will be finalized.
      operationId: collections_finalize_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FinalizeCollectionRequest'
        required: false
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinalizeCollectionResponse'
        '400':
          description: HTTP 400 Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        '401':
          description: HTTP 401 Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error401'
        '403':
          description: HTTP 403 Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error403'
        '404':
          description: HTTP 404 Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
components:
  schemas:
    FinalizeCollectionRequest:
      type: object
      properties:
        document_ids:
          title: Document IDs
          type: array
          items:
            type: string
          description: >-
            Optional list of document IDs to finalize. If not provided, all
            recognized documents in the collection will be finalized.
          example:
            - d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6
            - a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4
        product_type:
          title: Product Type
          type: string
          enum:
            - income
            - employment
          default: income
          description: Product type for finalization. Defaults to 'income' if not provided.
          example: income
    FinalizeCollectionResponse:
      type: object
      required:
        - users
      properties:
        users:
          title: Users
          type: array
          items:
            $ref: '#/components/schemas/FinalizeUser'
          description: List of users with their links and documents
    Error400:
      description: ''
      type: object
      properties:
        error:
          description: ''
          type: object
          properties:
            code:
              description: ''
              type: string
              example: incorrect_parameters
            message:
              description: ''
              type: string
              example: Incorrect request parameters
            extra:
              description: ''
              type: object
              properties:
                invalid-params:
                  description: ''
                  type: array
                  items:
                    description: ''
                    type: object
                    properties:
                      field:
                        description: ''
                        type: string
                        example: access_token
                      message:
                        description: ''
                        type: string
                        example: This field is required.
                  example:
                    - field: access_token
                      message: This field is required.
    Error401:
      description: ''
      type: object
      properties:
        error:
          description: ''
          type: object
          properties:
            code:
              description: ''
              type: string
              example: authentication_failed
            message:
              description: ''
              type: string
              example: No such token
    Error403:
      description: ''
      type: object
      properties:
        error:
          description: ''
          type: object
          properties:
            code:
              description: ''
              type: string
              example: not_authenticated
            message:
              description: ''
              type: string
              example: Authentication credentials were not provided.
    Error404:
      description: ''
      type: object
      properties:
        detail:
          description: ''
          type: string
          example: Not Found.
    FinalizeUser:
      type: object
      required:
        - id
        - links
      properties:
        id:
          title: User ID
          type: string
          description: Truv user ID
          example: a1b2c3d4e5f6478899aabbccddeeff00
        external_user_id:
          title: External User ID
          type: string
          nullable: true
          description: External system user ID (optional)
          example: ext_user_789
        links:
          title: Links
          type: array
          items:
            $ref: '#/components/schemas/FinalizeLink'
          description: List of links created/updated for this user
    FinalizeLink:
      type: object
      required:
        - link_id
        - status
        - documents
      properties:
        link_id:
          title: Link ID
          type: string
          description: Truv link ID
          example: c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9
        status:
          title: Status
          type: string
          description: >
            Current status of the link.


            Final statuses (processing complete): done, no_data, config_error,
            error, unavailable.

            For more details, see the Connection Lifecycle documentation.
          enum:
            - new
            - parse
            - full_parse
            - done
            - no_data
            - config_error
            - error
            - unavailable
          example: done
        documents:
          title: Documents
          type: array
          items:
            $ref: '#/components/schemas/FinalizeDocument'
          description: List of documents associated with this link
    FinalizeDocument:
      type: object
      required:
        - id
        - document_type
      properties:
        id:
          title: Document ID
          type: string
          description: Recognized document ID
          example: d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6
        document_type:
          title: Document Type
          type: string
          description: Type of the document (uppercase)
          example: PAYSTUB
        document_subtype:
          title: Document Subtype
          type: string
          nullable: true
          description: Subtype of the document (uppercase, optional)
          example: null
  securitySchemes:
    ClientID:
      type: apiKey
      description: Client ID
      name: X-Access-Client-Id
      in: header
    AccessKey:
      type: apiKey
      description: Client Access Key
      name: X-Access-Secret
      in: header

````