# Getting started

## Installation

The redivis library is [hosted on NPM](https://www.npmjs.com/package/redivis). Use npm to install, or specify `redivis-js` in your package.json

```bash
npm install --save redivis
```

## Authentication

The redivis-js library supports two forms of authentication: API token and OAuth

### OAuth (recommended)

The OAuth flow is recommended for interactive sessions, and will automatically prompt you (or the end user) to authenticate with their Redivis credentials. If you're using the redivis-js library in a browser, a popup will appear when authorization is required. If using it in a Node.js environment, a URL will be printed&#x20;

### API Token

For non-interactive usage of the redivis-js library (in a Node.js environment), you can use an API token stored as an environment variable for authorization.&#x20;

First, follow the steps to [generate an API Token](https://apidocs.redivis.com/authorization). This API token must then be set as the `REDIVIS_API_TOKEN` environment variable before executing your script. You can set the variable for your current session by running the following in your terminal:

```bash
export REDIVIS_API_TOKEN=YOUR_TOKEN
```

## Usage

```python
import * as redivis from redivis

data = await redivis
  .organization('demo')
  .dataset('nyt covid us cases_deaths')
  .table('covid_us states')
  .listRows({ maxResults: 100 })
```

When referencing datasets, workflows, and tables on Redivis, you should be familiar with the [resource reference syntax](https://apidocs.redivis.com/referencing-resources).


---

# 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/api/client-libraries/redivis-js/getting-started.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.
