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

# Update Knowledge Document

> Activates or deactivates a document. Deactivating keeps the document but stops it being attached to new calls. Only completed (`READY`) documents can be toggled.

Activates or deactivates a document without deleting it.

## Overview

Deactivating keeps the document and its stored file — it simply stops being attached to new calls. Use it to park seasonal or draft material you expect to bring back, instead of deleting and re-uploading.

Calls already in progress are unaffected: a document is resolved when a call starts.

## Example

```bash theme={null}
curl -X PATCH https://api.instaview.sk/agents/$AGENT_ID/knowledge/$DOCUMENT_ID \
  -H "Authorization: Bearer $INSTAVIEW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "isActive": false }'
```

## Pending Documents

Only completed (`READY`) documents can be toggled. Activating a document whose file never arrived would produce something that lists as usable and fails when a call tries to read it, so it is rejected with a `409` instead.

## Error Scenarios

* **404 Not Found**: No such document on that agent
* **409 Conflict**: The document's upload has not been completed yet

## Related Resources

* [List Knowledge Documents](/api-reference/agents/knowledge/list-knowledge)
* [Delete Knowledge Document](/api-reference/agents/knowledge/delete-knowledge)


## OpenAPI

````yaml PATCH /agents/{id}/knowledge/{documentId}
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:
  /agents/{id}/knowledge/{documentId}:
    patch:
      tags:
        - Agents
      summary: Activate or deactivate a knowledge document
      description: >-
        Activates or deactivates a document. Deactivating keeps the document but
        stops it being attached to new calls. Only completed (`READY`) documents
        can be toggled.
      operationId: PublicAgentKnowledgeController_updateDocument_v1
      parameters:
        - name: id
          required: true
          in: path
          description: Agent the knowledge base belongs to.
          schema:
            type: string
            format: uuid
        - name: documentId
          required: true
          in: path
          description: Knowledge 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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicUpdateKnowledgeDocumentDto'
      responses:
        '200':
          description: Document updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicKnowledgeDocumentDto'
        '404':
          description: No such document on that agent.
        '409':
          description: The document's upload has not been completed yet.
      security:
        - bearer: []
components:
  schemas:
    PublicUpdateKnowledgeDocumentDto:
      type: object
      properties:
        isActive:
          type: boolean
          example: false
          description: >-
            Whether the agent may consult this document during a call.
            Deactivating keeps the document — it simply stops being attached to
            new calls.
      required:
        - isActive
    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.
        createdAt:
          format: date-time
          type: string
          example: '2026-08-08T10:15:00.000Z'
          description: When the document was created
      required:
        - id
        - title
        - status
        - isActive
        - createdAt
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: API key for authentication using Bearer scheme

````