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

# File imports

> Import CSV, JSON, JSONL, YAML, Excel, BibTeX, and markdown folders into KiwiFS.

File sources read a local file and turn each record into a markdown page. Every source also accepts the [common flags](https://docs.kiwifs.com/import/overview.md#common-flags): `--prefix`, `--id-column`, `--columns`, `--limit`, and `--dry-run`. The default `--prefix` is the file name without its extension.

## Tabular files

> [tab] CSV
>
> ```bash Terminal theme={null}
> kiwifs import --from csv --file people.csv --root ./knowledge
> ```
>
> The first row is the header. Each following row becomes a page.

> [tab] JSON
>
> ```bash Terminal theme={null}
> kiwifs import --from json --file items.json --root ./knowledge
> ```
>
> The file holds an array of objects.
>
> ```json items.json theme={null}
> [
>   { "id": "a", "name": "Item A", "status": "active" },
>   { "id": "b", "name": "Item B", "status": "draft" }
> ]
> ```

> [tab] JSONL
>
> ```bash Terminal theme={null}
> kiwifs import --from jsonl --file items.jsonl --root ./knowledge
> ```
>
> The file holds one object per line.
>
> ```json items.jsonl theme={null}
> {"id": "a", "name": "Item A", "status": "active"}
> {"id": "b", "name": "Item B", "status": "draft"}
> ```

> [tab] YAML
>
> ```bash Terminal theme={null}
> kiwifs import --from yaml --file items.yaml --root ./knowledge
> ```
>
> The file holds a list of mappings.
>
> ```yaml items.yaml theme={null}
> - id: a
>   name: Item A
>   status: active
> - id: b
>   name: Item B
>   status: draft
> ```

> [tab] Excel
>
> ```bash Terminal theme={null}
> kiwifs import --from excel --file records.xlsx --sheet "Sheet1" --root ./knowledge
> ```
>
> The first row of the sheet is the header. Without `--sheet`, KiwiFS reads the first sheet.

| Flag | Description |
| - | - |
| `--file` | Path to the file (required) |
| `--sheet` | Sheet name, for `excel` only |

`json` and `jsonl` share one reader that detects the format from the first character, so either value works for either file.

### File names

For JSON, JSONL, YAML, and Excel, an `id` or `_id` field becomes the file name. CSV rows use the row number unless you pass `--id-column`.

### Example

Given this CSV:

```csv people.csv theme={null}
name,email,department
Jane Doe,jane@example.com,Engineering
Bob Smith,bob@example.com,Product
```

`kiwifs import --from csv --file people.csv --id-column email` writes `people/jane@example.com.md`:

```markdown people/jane@example.com.md theme={null}
---
_imported_at: "2026-10-19T18:46:15Z"
_source: people
_source_id: csv:people:0
department: Engineering
email: jane@example.com
name: Jane Doe
---

# Jane Doe

| Field | Value |
|-------|-------|
| department | Engineering |
| email | jane@example.com |
| name | Jane Doe |
```

### Keep only some fields

```bash Terminal theme={null}
kiwifs import --from csv --file people.csv --columns "name,email" --prefix people
```

Fields you don't list are left out of the frontmatter.

## BibTeX

Import a `.bib` reference file. Each entry becomes a page named after its citation key.

```bash Terminal theme={null}
kiwifs import --from bibtex --file references.bib --prefix papers
```

KiwiFS maps common BibTeX fields to frontmatter:

| Frontmatter | From |
| - | - |
| `bibtex_key`, `bibtex_type` | Citation key and entry type |
| `title`, `year` | `title`, `year` |
| `authors` | `author`, split into a list |
| `venue` | `journal`, `booktitle`, `publisher`, or `howpublished` |
| `tags` | `keywords`, split into a list |

Other fields, such as `doi`, `url`, and `abstract`, are copied as-is.

## Markdown folders

Copy an existing folder of markdown files into the knowledge base without rewriting their content.

```bash Terminal theme={null}
kiwifs import --from markdown --path ./old-docs --prefix docs
```

`--path` can be a single `.md` file or a directory. KiwiFS walks subdirectories, keeps each file's frontmatter and body, and copies non-markdown files such as images next to them. To also convert Obsidian syntax, use [`--from obsidian`](https://docs.kiwifs.com/import/saas#obsidian) instead.

## Upload a file over REST

`POST /api/kiwi/import/upload` takes a multipart upload of up to 256 MB, so the file doesn't need to be on the server. It accepts `csv`, `json`, `jsonl`, `bibtex`, and `sqlite`.

```bash Terminal theme={null}
curl -X POST http://localhost:3333/api/kiwi/import/upload \
  -F from=csv \
  -F file=@people.csv \
  -F prefix=people \
  -F id_column=email
```

| Field | Description |
| - | - |
| `file` | The file to import (required) |
| `from` | Source type (required) |
| `prefix` | Target folder. Defaults to the uploaded file name. |
| `id_column` | Field to use as the file name |
| `table`, `query` | Table or query, for `sqlite` uploads |
| `field_mappings` | JSON array of field mappings, as produced by `infer-fields` |
| `mode` | `import` (default), `preview` (first 5 records), or `infer-fields` |

The web UI import wizard uses this endpoint for files you pick from your computer.

## From the API or an agent

CSV, JSON, and JSONL also work with `POST /api/kiwi/import` and the `kiwi_import` MCP tool. Both read the `file` path on the machine running KiwiFS.

```json kiwi_import theme={null}
{
  "from": "csv",
  "file": "/srv/exports/people.csv",
  "prefix": "people"
}
```

## Related

> [card] [Import overview](https://docs.kiwifs.com/import/overview.md)
>
> Output format, common flags, and re-import rules.

> [card] [Ingest documents](https://docs.kiwifs.com/import/connections.md#ingest-documents)
>
> Convert PDF, DOCX, and PPTX files into pages.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.