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

# occtoo sources

> Create and change sources, their properties and folders, and import entries from CSV, Excel and Avro files

A source holds the raw entries you send to Occtoo. Use `occtoo sources` to create sources, manage their properties and folders, import files, and read or delete single entries.

Most commands take `--output json` (`-o json`), create and edit commands take JSON through `--file` (`-f`) or stdin, and delete commands take `--yes` (`-y`). See [Scripting and CI](https://docs.occtoo.com/cli/scripting.md).

## List sources

```bash theme={null}
occtoo sources list
occtoo sources list --name chair --type media --output json
```

In a terminal, you can type to filter the list and press Enter to see a source. With `--output`, the CLI prints a plain table or JSON instead.

| Flag | Description |
| - | - |
| `--name <NAME>` | Only sources whose name contains this text |
| `--type <KIND>` | Only sources of this type: `generic` or `media` |
| `--status <STATUS>` | Only sources with this status: `active` or `purging` |
| `--limit <LIMIT>` | Maximum number of sources to return. Default `100` |

## Show a source

```bash theme={null}
occtoo sources show products
```

Shows a source and its properties. In a terminal, a long property list is searchable. Leave out the id to pick a source from a list.

## Create a source

```bash theme={null}
occtoo sources create
occtoo sources create --file source.json
```

In a terminal, the CLI asks for each value. Otherwise, pass JSON. Only `id` and `name` are required:

```json theme={null}
{
  "id": "products",
  "name": "Products",
  "description": "All products",
  "type": "Generic",
  "properties": [
    { "id": "sku", "displayName": "SKU", "type": "Text" },
    { "id": "tags", "type": "List", "delimiter": "," }
  ]
}
```

* Source types: `Generic`, `Media`.
* Property types: `Text`, `LocalizedText`, `List`, `LocalizedList`, `Boolean`, `Integer`, `Decimal`, `Timestamp`, `Wildcard`.
* A property without `displayName` is named after its id.

## Edit a source

```bash theme={null}
occtoo sources edit products
echo '{"name": "Catalogue"}' | occtoo sources edit products
```

Changes the name or description. Both fields are optional, and an empty description clears it.

## Import a file

```bash theme={null}
occtoo sources import products products.xlsx
occtoo sources import products export.csv --delimiter ';' --yes --output json
```

Imports the entries of a CSV, Excel or Avro file. The CLI shows the columns and first rows it found, then asks before it writes. The file is sent while it is read, so its size doesn't matter.

| Flag | Description |
| - | - |
| `--delimiter <DELIMITER>` | What separates the values of a CSV file. When left out, the CLI works it out from the header row |
| `--yes` | Import without asking |

### CSV and Excel

CSV files (`.csv`, `.tsv`, `.txt`) and Excel files (`.xlsx`, first worksheet) work the same way:

```csv theme={null}
sku,name(en),name(sv),price,tags
sku-1,Blue chair,Blå stol,100.5,summer|sale
```

* The first row names the columns.
* The column named `id`, or else the first column, holds the entry id.
* Every other column is a property. Name a column `name(en)` to set the value in one language.
* CSV files are UTF-8, separated by a comma, semicolon, tab or pipe.

### Avro

Avro object container files (`.avro`, uncompressed or deflate) hold one record per entry. The field named `id`, or else the first field, is the entry id. Every other field is a property named after the field:

| Avro type | Occtoo value |
| - | - |
| `string`, `enum`, `uuid` | Text |
| `int`, `long`, `float`, `double` | Number |
| `boolean` | True or false |
| `timestamp-millis`, `timestamp-micros`, `timestamp-nanos` | Timestamp |
| `date` | Text, such as `2026-11-20` |
| Array of strings | List |
| Map of strings | One text per language. The key is the language |
| Map of arrays of strings | One list per language |
| Union with `null` | `null` clears the value |

### How values are read

* A value is read as the type of its property. For example, `12.5` becomes a number for a `Decimal` property, and `a|b` becomes a list for a `List` property with the delimiter `|`.
* An empty cell clears the value of a property that has a type.
* A column that has no property in the source creates one, typed from its values. To choose the type yourself, create the property first with [`occtoo sources properties set`](#manage-properties).
* Rows that can't be imported are skipped. The CLI lists them, with the reason, in a file and prints its path at the end. The command then exits with an error.

## Write a few entries

```bash theme={null}
occtoo sources ingest products
occtoo sources ingest products --file entries.json
```

Writes a few entries, from prompts or as the JSON the API takes. For a file of entries, use [`import`](#import-a-file) instead.

```json theme={null}
{
  "entries": [
    {
      "id": "sku-1",
      "properties": [
        { "id": "name", "value": "Blue chair", "language": "en" },
        { "id": "price", "value": 100.5 },
        { "id": "tags", "value": ["summer", "sale"] }
      ]
    },
    { "id": "sku-old", "delete": true }
  ]
}
```

A value is a string, a number, `true` or `false`, a list of strings, or `null` to clear it. It has to fit the type of its property. A property the source doesn't have yet is created with the type of its first value. An entry with `"delete": true` is removed.

## Read and delete entries

```bash theme={null}
occtoo sources entries show products sku-1 sku-2
occtoo sources entries show products sku-1 --output json | jq '.[0].properties'
occtoo sources entries delete products sku-1 --yes
```

`entries show` prints entries as they are stored, one row per value. The API reads entries by id only and can't list the entries of a source. Entries are processed in the background, so something you wrote a moment ago may not be there yet.

## Manage properties

```bash theme={null}
echo '{"type": "Decimal"}' | occtoo sources properties set products price
occtoo sources properties set products --file properties.json
occtoo sources properties delete products price oldPrice --yes
```

`properties set` creates a property, or changes it when it exists. Every field is optional, and a field you leave out stays as it is:

```json theme={null}
{ "displayName": "Tags", "type": "List", "delimiter": ",", "description": "..." }
```

Leave out the property id to set several properties at once. They are saved together: if one is not valid, none are saved.

```json theme={null}
{
  "properties": [
    { "id": "price", "type": "Decimal" },
    { "id": "tags", "type": "List", "delimiter": "|" }
  ]
}
```

Changing the type of a property re-indexes its stored values in the background. `properties delete` removes properties and their values.

## Manage folders

Folders are named by their path from the top of the source, such as `campaigns/spring`.

```bash theme={null}
occtoo sources folders list productImages
occtoo sources folders create productImages "campaigns/Spring 2026" --parents
occtoo sources folders rename productImages campaigns/Spring2026 "Spring and summer 2026"
occtoo sources folders move productImages campaigns/Spring2026 archive
occtoo sources folders delete productImages archive --yes
```

| Command | What it does |
| - | - |
| `folders list <SOURCE>` | Lists every folder by path. `--parent <ID>` lists only the folders directly inside one folder. `--limit` defaults to `1000` |
| `folders create <SOURCE> <PATH>` | Creates a folder. `--parents` (`-p`) also creates the folders above it. `--name` sets a display name that differs from the last part of the path |
| `folders rename <SOURCE> <PATH> <NAME>` | Changes the display name. The path stays the same |
| `folders move <SOURCE> <PATH> <INTO>` | Moves a folder, with everything in it, into another folder. Use `/` for the top of the source |
| `folders delete <SOURCE> <PATH>` | Deletes a folder, the folders in it, and the entries they hold |

In a path, a folder name keeps only its letters and digits. For example, a folder named `Spring 2026` has the path name `Spring2026`.

## Empty or delete a source

```bash theme={null}
occtoo sources purge products --wait
occtoo sources delete products --yes
```

* `purge` removes every entry and keeps the source, its properties and folders. The entries are removed in the background. Until then, the source has the status `Purging` and takes no new entries. `--wait` waits until they are gone.
* `delete` removes the source with its properties, folders and entries. It is refused while a card definition uses the source.


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