> ## Documentation Index
> Fetch the complete documentation index at: https://velt-v6-0-0-beta-5.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Knowledge

Use this API to replace a knowledge source's content. The pipeline re-runs (conversion, rule extraction, embedding) and the source's version is bumped.

# Endpoint

`POST https://api.velt.dev/v2/memory/knowledge/update`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="sourceId" type="string" required>
      The knowledge source to update.
    </ParamField>

    <ParamField body="newContent" type="string" required>
      The replacement content.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Replace a source's content

```JSON theme={null}
{
  "data": {
    "sourceId": "src_9a8...",
    "newContent": "# Brand Guidelines v2\n\n- Always cite medical claims..."
  }
}
```

# Response

The response reports a diff of extracted rules (`added`, `removed`, `unchanged`) and the new version number.

#### Success Response

```JSON theme={null}
{
  "result": {
    "diff": {
      "added": ["..."],
      "removed": ["..."],
      "unchanged": 12
    },
    "newVersion": 2
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "diff": {
        "added": ["..."],
        "removed": ["..."],
        "unchanged": 12
      },
      "newVersion": 2
    }
  }
  ```
</ResponseExample>
