---
title: "Upsert"
description: "Upsert a single vector record in a knowledge base."
canonical_url: "https://docs.vettero.com/build/workflows/blocks/kb/upsert"
---
# Upsert

> Upsert a single vector record in a knowledge base.

<block-meta block="Yes" channels="Any" folder="kb" group="Knowledge Base" groupTo="/build/workflows/blocks/kb" icon="i-lucide-upload" pipe="Value" scope="Any" tool="Yes" type="kb.upsert">



</block-meta>

**Upsert** (canvas label **KB Upsert**) adds or replaces one vector in a [knowledge base](https://docs.vettero.com/data/knowledge-bases). Same **Vector ID** overwrites the previous record.

The store embeds **Text** for you. On a **Strict** store, **Metadata** must match the defined meta fields. On a loose store, metadata is optional key/value pairs. **Read only** stores reject upsert.

To ingest a file or URL instead of one record, use [Add Datasource](https://docs.vettero.com/build/workflows/blocks/kb/add-datasource).

## Configure

<table>
<thead>
  <tr>
    <th>
      Setting
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Knowledge base
      </strong>
    </td>
    
    <td>
      Store to write (required)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Vector ID
      </strong>
    </td>
    
    <td>
      Id to create or replace (required)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Text
      </strong>
    </td>
    
    <td>
      Content to embed (required)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Metadata
      </strong>
    </td>
    
    <td>
      Required on Strict stores; optional key/value pairs otherwise
    </td>
  </tr>
</tbody>
</table>

## Handles

<table>
<thead>
  <tr>
    <th>
      Handle
    </th>
    
    <th>
      Role
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        In
      </strong>
      
       (target)
    </td>
    
    <td>
      Incoming connection
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Out
      </strong>
      
       (source)
    </td>
    
    <td>
      Continues after the upsert
    </td>
  </tr>
</tbody>
</table>

## Pipe schema

The next block reads this on the data pipe (`pipe.value`). The value is an object:

<table>
<thead>
  <tr>
    <th>
      Key
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        success
      </code>
    </td>
    
    <td>
      boolean
    </td>
    
    <td>
      Whether the upsert ran
    </td>
  </tr>
</tbody>
</table>

## Use case

- Index a policy snippet or FAQ answer with a stable id.
- Keep a tagged record in sync after a [table](https://docs.vettero.com/build/workflows/blocks/table/update) update (same id, new text and metadata).

<block-page-nav>



</block-page-nav>


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
