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

# File Upload

> Upload files to the knowledge base for automatic fact extraction

## upload\_file()

Upload a file from disk. Vrin accepts PDFs, CSVs, text files, and other common document formats.

```python theme={null}
result = client.upload_file("report.pdf")
```

### Parameters

<ParamField body="file_path" type="string | Path" required>
  Path to the file to upload. Accepts strings or `pathlib.Path` objects.
</ParamField>

<ParamField body="save_to_memory" type="bool" default="True">
  If `True`, persist extracted knowledge to the knowledge base. If `False`, the file is processed but facts are not stored permanently.
</ParamField>

<ParamField body="wait" type="bool" default="True">
  If `True`, poll until processing completes.
</ParamField>

<ParamField body="poll_interval" type="float" default="3.0">
  Seconds between status polls when `wait=True`.
</ParamField>

<ParamField body="max_wait" type="float" default="120.0">
  Maximum seconds to wait when `wait=True`.
</ParamField>

### Example

```python theme={null}
# Upload and wait for processing
result = client.upload_file("quarterly_report.pdf", save_to_memory=True)
print(f"Upload status: {result['status']}")

# Upload without waiting
result = client.upload_file("large_dataset.csv", wait=False)
upload_id = result.get("upload_id")
```

## upload\_bytes()

Upload raw bytes directly without a file on disk.

```python theme={null}
with open("data.csv", "rb") as f:
    result = client.upload_bytes(
        f.read(),
        "data.csv",
        content_type="text/csv"
    )
```

### Parameters

<ParamField body="file_bytes" type="bytes" required>
  File content as bytes.
</ParamField>

<ParamField body="filename" type="string" required>
  Name of the file. Used for MIME type detection and display.
</ParamField>

<ParamField body="content_type" type="string">
  MIME type (e.g. `"application/pdf"`). Auto-detected from filename if not provided.
</ParamField>

<ParamField body="save_to_memory" type="bool" default="True">
  If `True`, persist extracted knowledge.
</ParamField>

<ParamField body="wait" type="bool" default="True">
  If `True`, poll until processing completes.
</ParamField>

<ParamField body="poll_interval" type="float" default="3.0">
  Seconds between status polls.
</ParamField>

<ParamField body="max_wait" type="float" default="120.0">
  Maximum seconds to wait.
</ParamField>

## get\_upload\_status()

Check the processing status of a file upload.

```python theme={null}
status = client.get_upload_status("upload_abc123")
print(status["status"])  # "processing" | "completed" | "failed"
```

### Parameters

<ParamField body="upload_id" type="string" required>
  The upload ID returned by `upload_file()` or `upload_bytes()`.
</ParamField>

## Supported file types

| Format   | Extension | Notes                                   |
| -------- | --------- | --------------------------------------- |
| PDF      | `.pdf`    | Text extraction + OCR for scanned pages |
| CSV      | `.csv`    | Rows parsed as structured records       |
| Text     | `.txt`    | Plain text, inserted as-is              |
| Markdown | `.md`     | Parsed with section awareness           |

## What happens during upload

1. File is uploaded via multipart POST to the upload endpoint
2. Vrin detects the file type and extracts text content
3. Content is chunked, facts are extracted, and everything is indexed
4. The upload status transitions: `processing` -> `completed` (or `failed`)
