> For the complete documentation index, see [llms.txt](https://docs.redivis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version.md).

# Version

## *class* <mark style="color:purple;">Version</mark>

A version of a [dataset](https://docs.redivis.com/api/client-libraries/redivis-js/reference/dataset.md). Each released version of a dataset is immutable; changes are made in the dataset's unreleased `next` version, which then becomes the `current` version once released.

## Constructors

| Method                                                                                                                                          | Description                         |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| [**`Dataset.version`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/dataset/dataset.version.md)(\[tag])                  | Return a Version of a dataset.      |
| [**`Dataset.listVersions`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/dataset/dataset.listversions.md)(\[maxResults]) | List the Versions of a dataset.     |
| [**`Version.previousVersion`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.previousversion.md)()        | Return the version before this one. |
| [**`Version.nextVersion`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.nextversion.md)()                | Return the version after this one.  |

## Examples

```javascript
const dataset = redivis.organization('demo').dataset('iris_species');

const version = await dataset.version('v1_0');
await version.get();
console.log(version.properties);

const previous = await version.previousVersion(); // null if this is the first version
const datasetAtVersion = version.dataset(); // The dataset at this version

for (const version of await dataset.listVersions()) {
  console.log(version.tag);
}
```

## Attributes

| Name             | Description                                                                                                                                                                                                                       |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`tag`**        | The version's tag, e.g. `v1_0`, `current`, or `next`.                                                                                                                                                                             |
| **`properties`** | An object containing the [API resource representation of the version](https://docs.redivis.com/api/resource-definitions/version.md). This will only be populated after certain methods are called, particularly the `get` method. |

## Methods

| Method                                                                                                                                   | Description                                                                                                          |
| ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| [**`Version.dataset`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.dataset.md)()                 | Return the [Dataset](https://docs.redivis.com/api/client-libraries/redivis-js/reference/dataset.md) at this version. |
| [**`Version.delete`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.delete.md)()                   | Delete the version.                                                                                                  |
| [**`Version.exists`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.exists.md)()                   | Check whether the version exists.                                                                                    |
| [**`Version.get`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.get.md)()                         | Fetch the version's metadata, populating `version.properties`.                                                       |
| [**`Version.nextVersion`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.nextversion.md)()         | Return the version after this one, if any.                                                                           |
| [**`Version.previousVersion`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.previousversion.md)() | Return the version before this one, if any.                                                                          |
| [**`Version.undelete`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.undelete.md)()               | Restore a deleted version.                                                                                           |
| [**`Version.update`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/version/version.update.md)(options)            | Update the version's label and release notes.                                                                        |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.redivis.com/api/client-libraries/redivis-js/reference/version.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
