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

# Collection.ingest

```python theme={"system"}
def Collection.ingest(
    data: IngestionData,
    allow_existing: bool = True,
    *,
    show_progress: bool | Callable[[float], None] = False,
) -> list[UUID]
```

Ingest data into a collection.

<Note>
  You need write permission on the collection to ingest data points.
</Note>

## Parameters

<ParamField path="data" type="IngestionData">
  The data to ingest.

  Supported `IngestionData` data types are:

  * An iterable of mappings, with one mapping per datapoint.
  * A mapping from field names to ordered sequences, `numpy.ndarray` objects, or `pandas.Series` objects.
  * A `pandas.DataFrame`, with column names mapped to dataset fields.
  * An `xarray.Dataset`, with variables and coordinates mapped to dataset fields.

  A mapping is always interpreted as column-oriented data. Wrap a single record in an iterable, such as `[record]`.
  Every datapoint must include `time`. Tilebox generates `id` and `ingestion_time`. Missing optional values leave their corresponding fields unset.
</ParamField>

<ParamField path="allow_existing" type="bool">
  Datapoint fields are used to generate a deterministic unique `UUID` for each
  datapoint in a collection. Duplicate data points result in the same ID being generated.
  If `allow_existing` is `True`, `ingest` will skip those data points, since they already exist.
  If `allow_existing` is `False`, `ingest` will raise an error if any of the generated datapoint IDs already exist.
  Defaults to `True`.
</ParamField>

<ParamField path="show_progress" type="bool | Callable[[float], None]">
  If `True`, display a progress bar while ingesting many datapoints. You can also pass a callback to receive progress values between `0` and `1`. Defaults to `False`.
</ParamField>

## Returns

List of datapoint IDs that were ingested, including the IDs of existing data points in case of duplicates and
`allow_existing=True`.

<RequestExample>
  ```python Python theme={"system"}
  collection.ingest([
      {
          "time": "2023-05-01T12:00:00Z",
          "value": 1,
          "sensor": "A",
      },
      {
          "time": "2023-05-02T12:00:00Z",
          "value": 2,
          "sensor": "B",
      },
  ])
  ```
</RequestExample>

## Errors

<ParamField path="ArgumentError" type="found existing datapoints with same id">
  If `allow_existing` is `False` and any of the datapoints attempting to ingest already exist.
</ParamField>
