> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://docs.mammoth.io/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# Mammoth API quickstart

> From nothing to a transformed, exported dataset in about five minutes, shown three ways—curl, the mammoth-io Python SDK, and the Mammoth CLI.

From nothing to a transformed dataset, three ways. All three do the same thing against the same API.

You need an API token first—see [Authentication](https://docs.mammoth.io/build/auth).

## 1 · Install


**CLI**

```bash
curl -fsSL https://raw.githubusercontent.com/EdgeMetric/mammothsdk/main/mammoth-cli/installers/mammoth-install.sh | sh
mammoth --version
```

**Python SDK**

```bash
pip install mammoth-io
```

**curl**

```bash
# Nothing to install.
```


## 2 · Authenticate

```bash
export MAMMOTH_API_TOKEN="mm_<your-token>"
```


**CLI**

```bash
mammoth auth login --input creds.json --storage file --output json --no-input
mammoth doctor --output json --no-input
```

**mammoth-io**

The SDK is async: run these steps inside one `async def main()` and start it with `asyncio.run(main())` (in a notebook, `await` directly).

```python
import asyncio
import os

from mammoth import MammothClient


async def main():
    async with MammothClient(
        api_token=os.environ["MAMMOTH_API_TOKEN"],
    ) as client:
        ...  # steps 3 to 7 go here


asyncio.run(main())
```


> **The CLI does not read that environment variable**
>
> It is how the **SDK** gets its token. The CLI has no environment-variable shortcut: it reads the credentials you stored above, from your OS keyring or from the credentials file. See [Authentication](https://docs.mammoth.io/build/auth).

## 3 · Pick a project

Most operations need a project. The workspace comes from the token.


**CLI**

```bash
mammoth project list --output json --no-input
mammoth context project use <PROJECT_ID>
```

**mammoth-io**

```python
await client.projects.list()    # {"projects": [...], "offset": 0, ...}
client.set_project_id(PROJECT_ID)
```


## 4 · Load some data


**CLI**

```bash
mammoth dataset create --input '{
  "dataset_spec": {"url": "https://sampledata.mammoth.io/Multi-Store_Retail_Sales.csv"},
  "ds_creation_type": "weburl"
}' --output json --no-input
```

**mammoth-io**

```python
await client.datasets.list()
# upload a local file, or create from a URL, see the SDK reference
```


> **Keep the dataset id**
>
> The response carries it: `{"status": "ready", "dataset_id": 303686, "job_id": 14794754}`. Both create commands block until the dataset is ready, so there is no job to poll by hand.

## 5 · Find the view

A dataset has one or more views, and transformations act on a **view**, not on the dataset. Take the id of the first one.

```bash
mammoth view list <DATASET_ID> --project <PROJECT_ID> --output json --no-input
```

## 6 · Transform it

A **View** is the object you work on: it wraps a dataview and carries the transformation methods. Transformations apply in place—each call sends a task to the pipeline, waits for it, and refreshes the view.


**CLI**

```bash
mammoth view transform math <VIEW_ID> --project <PROJECT_ID> \
  --input '{"expression": "quantity_sold * unit_price", "new_column": "revenue"}'
```

**mammoth-io**

```python
from mammoth import Condition, Operator

view = await client.views.get(VIEW_ID)
await view.filter_rows(Condition("quantity_sold", Operator.GTE, 10))
await view.math("quantity_sold * unit_price", new_column="revenue")
```


## 7 · Get the result out


**CLI**

```bash
mammoth view export csv <VIEW_ID> --project <PROJECT_ID> --output json --no-input
```

The command writes a local file and refuses one that already exists with `file_exists` (exit 6). Pass `--overwrite` to replace it.

**mammoth-io**

```python
await view.export.to_csv("output.csv")
```


## 8 · Clean up

Delete anything temporary. Note the confirmation: destructive commands need `--yes`, and there is no prompt when there is no terminal.

```bash
mammoth dataset delete <DATASET_ID> --project <PROJECT_ID> --yes --output json --no-input
```

## Next up

- [Command contract](https://docs.mammoth.io/build/): all command families, with blast radius.
- [For coding agents](https://docs.mammoth.io/agents/): the discovery loop, the envelope, exit codes.

---
Source: https://docs.mammoth.io/build/quickstart.md · Updated: 2026-10-15