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

# Ingest Knowledge

Use this API to submit reference material (guidelines, standards, policy docs) to your Memory knowledge base. Ingestion is asynchronous: the call returns immediately with a `sourceId`, and conversion, rule extraction, and embedding run in the background. Poll [Get Ingest Status](/api-reference/rest-apis/v2/memory/knowledge/ingest-status) until the status is terminal. Supported file types: PDF, CSV, Excel (`.xlsx`), and plain text.

# Endpoint

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

# 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

The request is a discriminated union on `source`: send `source: "inline"` with a base64 `file` (decoded size up to 5 MB), or `source: "fileRef"` with a `gs://` URI from [Get Upload URL](/api-reference/rest-apis/v2/memory/knowledge/upload-url) (up to 30 MB).

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="source" type="string" required>
      `inline` or `fileRef`.
    </ParamField>

    <ParamField body="file" type="object">
      Required when `source` is `inline`. `{ base64, mimeType, fileName, fileSize }`. `base64` is the encoded file bytes (decoded size up to 5 MB); `fileName` is 1 to 255 characters; `fileSize` is in bytes.
    </ParamField>

    <ParamField body="fileRef" type="string">
      Required when `source` is `fileRef`. The `gs://` URI returned by Get Upload URL.
    </ParamField>

    <ParamField body="mimeType" type="string">
      Required when `source` is `fileRef`. One of the supported types: `application/pdf`, `text/csv`, `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`, or `text/plain`.
    </ParamField>

    <ParamField body="organizationId" type="string">
      Scope the source to one organization.
    </ParamField>

    <ParamField body="documentId" type="string">
      Scope the source to one document. Requires `organizationId`.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Inline (file up to 5 MB)

```JSON theme={null}
{
  "data": {
    "source": "inline",
    "file": {
      "base64": "JVBERi0xLjQK...",
      "mimeType": "application/pdf",
      "fileName": "brand-guidelines.pdf",
      "fileSize": 184320
    }
  }
}
```

#### By reference (file up to 30 MB)

```JSON theme={null}
{
  "data": {
    "source": "fileRef",
    "fileRef": "gs://bucket/path/original.pdf",
    "mimeType": "application/pdf"
  }
}
```

# Response

Ingestion runs in the background. Poll Get Ingest Status with the returned `sourceId` until the status is `completed` or `failed`.

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "processing",
    "sourceId": "src_9a8...",
    "message": "Ingestion started."
  }
}
```

#### Failure Response

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

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "processing",
      "sourceId": "src_9a8...",
      "message": "Ingestion started."
    }
  }
  ```
</ResponseExample>
