# Programmatic

You can interface with Redivis data programmatically using the Redivis R, Python, and Javascript client libraries, which allow external environments using these programming languages to connect to Redivis, facilitating integration with a wide variety of scientific libraries and paradigms.&#x20;

These libraries leverage the underlying REST API, which can also be used if you want to connect to Redivis from another programming language.

{% hint style="info" %}
You can also use R and Python to interface with data directly on Redivis, using the integrated [Redivis notebooks](/reference/workflows/notebooks.md). Importantly, the R or Python code that you write in a notebook is the same as what you would write elsewhere, allowing you to easily port your analyses between Redivis and other systems.
{% endhint %}

{% hint style="warning" %}
Note that, if data exports are restricted, you might first need to [gain approval to export the table](/reference/data-access/usage-rules.md#requesting-export-approval) before exporting to an external environment.
{% endhint %}

## Python

The **Programmatic** tab in the table export modal contains a code snippet to help you get started in working with Redivis data via Python. E.g.:

```python
dataset = redivis.organization("Demo").dataset("iris_species")
table = dataset.table("Iris")

table.to_pandas_dataframe()
# 	Id	SepalLengthCm	SepalWidthCm	PetalLengthCm	PetalWidthCm	Species
# 0	33	5.2	        4.1	        1.5	        0.1	        Iris-setosa
# ...

# Other methods to read tabular data:
# table.to_arrow_batch_iterator()
# table.to_arrow_dataset()
# table.to_arrow_table()
# table.to_geopandas_dataframe()
# table.to_dask_dataframe()
# table.to_polars_lazyframe()

# Reading unstructured data from file index tables:
# table.list_files()
# table.download_files()
```

*View the full* [*redivis-python documentation*](/api/client-libraries/redivis-python.md)

## R

The **Programmatic** tab in the table export modal contains a code snippet to help you get started in working with Redivis data via R. E.g.:

```r
dataset <- redivis$organization("Demo")$dataset("iris_species")
table <- dataset$table("Iris")

table$to_tibble()
# 	Id	SepalLengthCm	SepalWidthCm	PetalLengthCm	PetalWidthCm	Species
# 0	33	5.2	        4.1	        1.5	        0.1	        Iris-setosa
# ...

# Other methods to read tabular data:
# table$to_arrow_batch_reader()
# table$to_arrow_dataset()
# table$to_arrow_table()
# table$to_data_frame()
# table$to_data_table()
# table$to_sf_tibble()

# Reading unstructured data from file index tables:
# table$list_files()
# table$download_files()
```

*View the full* [*redivis-r documentation*](/api/client-libraries/redivis-r.md)

## REST API

The Redivis REST API provides an intuitive, resource-based approach to programmatically interfacing with Redivis. It opens up the ability to query, manipulate, and export data (and other Redivis resources) from within any programming language, supporting the workflows and tools that are familiar and best suited to your use case.

```bash
curl --header "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    https://redivis.com/api/v1/tables/demo.ghcn_daily_weather_data.stations/rows?format=csv
```

*View the full* [*REST API documentation*](/api/rest-api/general-structure.md)


---

# 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/tables/exporting-tables/programmatic.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.
