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

# Complete Contact Document Upload

> Confirms the file was uploaded to the presigned URL. The stored object is verified — it must exist, be within the size limit, be no larger than the size declared when the upload was started, and carry the content type the URL was issued for — and only then does the document become usable on calls. A file that fails verification is deleted and its reservation released. Safe to retry: completing an already-completed document returns it unchanged.

Confirms that the file was uploaded to the presigned URL and makes the document usable on calls.

## Overview

The stored object is verified before anything changes: it must exist, be within the 20 MiB limit, be **no larger than the size you declared** when starting the upload, and carry the content type the URL was issued for. A file that fails any of these is deleted, its reservation is released, and you get a `400` saying which check failed.

Safe to retry. Completing an already-completed document returns it unchanged with a `200`.

## Example

```bash theme={null}
curl -X POST https://api.instaview.sk/contacts/$CONTACT_ID/documents/$DOCUMENT_ID/complete \
  -H "Authorization: Bearer $INSTAVIEW_API_KEY"
```

```json theme={null}
{
  "id": "5d3c2b1a-0f9e-4d8c-b7a6-5f4e3d2c1b0a",
  "title": "Cover letter",
  "fileName": "cover-letter.pdf",
  "mimeType": "application/pdf",
  "sizeBytes": 482133,
  "status": "READY",
  "isActive": true,
  "source": "UPLOAD",
  "createdAt": "2026-09-05T09:30:00.000Z"
}
```

## Error Scenarios

* **400 Bad Request**: Nothing has been uploaded to the URL yet, or the stored file is too large, larger than declared, or of a different content type. A file that fails verification is deleted
* **404 Not Found**: No such document on that contact
* **429 Too Many Requests**: Completion rate limit exceeded — wait for `Retry-After` seconds

## Related Resources

* [Start Contact Document Upload](/api-reference/contacts/documents/start-upload)
* [List Contact Documents](/api-reference/contacts/documents/list-documents)


## OpenAPI

````yaml POST /contacts/{id}/documents/{documentId}/complete
openapi: 3.0.0
info:
  title: InstaView API
  description: |-
    InstaView API Documentation

    ## Authentication

    All endpoints require API key authentication using Bearer token:
    ```
    Authorization: Bearer sk_your_api_key_here
    ```

    ## API Key Management

    The API Key module provides comprehensive key management for:
    - **Direct Client Keys**: Company-scoped keys for your applications
    - **ATS Partner Keys**: Resource-scoped keys for ATS integrations

    ### Key Features
    - HMAC-SHA256 hashing for API key storage
    - Configurable rate limiting
    - Comprehensive audit logging
    - Company-level isolation
    - Resource scoping for ATS partners
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.instaview.sk
    description: Production API Gateway
security: []
tags: []
paths:
  /contacts/{id}/documents/{documentId}/complete:
    post:
      tags:
        - Contacts
      summary: Complete a contact document upload
      description: >-
        Confirms the file was uploaded to the presigned URL. The stored object
        is verified — it must exist, be within the size limit, be no larger than
        the size declared when the upload was started, and carry the content
        type the URL was issued for — and only then does the document become
        usable on calls. A file that fails verification is deleted and its
        reservation released. Safe to retry: completing an already-completed
        document returns it unchanged.
      operationId: PublicContactDocumentsController_completeUpload_v1
      parameters:
        - name: id
          required: true
          in: path
          description: Contact the document belongs to.
          schema:
            type: string
            format: uuid
        - name: documentId
          required: true
          in: path
          description: Document id.
          schema:
            type: string
            format: uuid
        - name: companyId
          required: false
          in: query
          description: >-
            Required for ATS API keys to specify which company to access.
            Ignored for standard company API keys.
          schema:
            type: string
      responses:
        '200':
          description: Upload verified; the document is now READY
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicKnowledgeDocumentDto'
        '400':
          description: >-
            Nothing was uploaded to the URL, or the stored file failed
            verification. A file that fails verification is deleted.
        '404':
          description: No such document on that contact.
        '429':
          description: >-
            Upload rate limit exceeded. This endpoint has a lower limit than the
            rest of the API — wait for the number of seconds in the
            `Retry-After` header before retrying.
      security:
        - bearer: []
components:
  schemas:
    PublicKnowledgeDocumentDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 123e4567-e89b-12d3-a456-426614174000
          description: Document ID
        title:
          type: string
          example: Benefits and perks
          description: Human-readable label for the document
        fileName:
          type: string
          example: benefits-and-perks.pdf
          description: Original file name as uploaded
        mimeType:
          type: string
          example: application/pdf
          description: MIME type of the stored file
        sizeBytes:
          type: number
          example: 482133
          description: >-
            Size of the stored file in bytes, as verified against storage.
            Absent until the upload is READY.
        status:
          type: string
          enum:
            - PENDING
            - READY
          example: READY
          description: >-
            `PENDING` while waiting for the file to be uploaded to the presigned
            URL and the upload to be completed; `READY` once the file is
            confirmed stored. Only READY documents are attached to calls.
        isActive:
          type: boolean
          example: true
          description: >-
            Whether the agent may consult this document during a call. Always
            false while the upload is PENDING.
        source:
          type: string
          enum:
            - UPLOAD
            - CV
          example: UPLOAD
          description: >-
            `UPLOAD` for a file attached through the API or the dashboard. `CV`
            for the document the platform produces from a contact's processed CV
            (contacts only); a `CV` document can be deactivated but not renamed
            or deleted. Always `UPLOAD` on an agent's knowledge base.
        createdAt:
          format: date-time
          type: string
          example: '2026-08-08T10:15:00.000Z'
          description: When the document was created
      required:
        - id
        - title
        - status
        - isActive
        - source
        - createdAt
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: API key for authentication using Bearer scheme

````