# Using the API

## Programmatic imports

In addition to uploading data through the browser interface, you can leverage the [redivis-python](/api/client-libraries/redivis-python.md) and [redivis-r](/api/client-libraries/redivis-r/reference/redivis.md) libraries, as well as the generic [REST API](/api/rest-api/general-structure.md), to automate data ingest and data release pipelines. These libraries can be used for individual file uploads similar to the interface, as well as for streaming data ingest pipelines.

Basic examples are provided below. Consult the complete client library documentation for more details and additional examples.

{% tabs %}
{% tab title="Python" %}

```python
import redivis

# Could also create a dataset under an organization:
# dataset = redivis.organization("your_organization").dataset("Dataset name")
dataset = redivis.user("your_username").dataset("Dataset name")

# public_access_level can be one of ('none', 'overview', 'metadata', 'sample', 'data')
dataset.create(public_access_level="overview")

# Create a table on the dataset. Datasets may have multiple tables
table = (
    dataset
    .table("Table name")
    .create(description="Some description")
)

# Upload a file to the table:
upload = table.upload().create(
    "./data.csv",           # Path to file, data frame, raw bytes, etc
    type="delimited",       # Inferred from file extension if not provided
    ...                     # See documentation for all parameters
)

# Optional: add more uploads to this table, or create other tables.
# Multiple uploads on the same table will be appended together.

# Release version
dataset.release()
```

{% endtab %}

{% tab title="R" %}

```
library(redivis)

# Could also create a dataset under an organization:
# dataset <- redivis$organization("your_organization")$dataset("Dataset name")
dataset <- redivis$user("your_username")$dataset("Dataset name")

# public_access_level can be one of ('none', 'overview', 'metadata', 'sample', 'data')
dataset$create(public_access_level="overview")

# Create a table on the dataset. Datasets may have multiple tables
table = (
    dataset
    $table("Table name")
    $create(description="Some description")
)

# Upload a file to the table. 
# You can create multiple uploads per table, in which case they'll be appended together.
upload = table$upload()$create(
    "./data.csv",           # Path to file, data.frame, raw vector, etc
    type="delimited",       # Inferred from file extension if not provided
    ...                     # See documentation for all parameters
)

# Optional: add more uploads to this table, or create other tables.
# Multiple uploads on the same table will be appended together.

# Release version
dataset$release()
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redivis.com/reference/datasets/create-and-edit-datasets/using-the-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
