> ## Documentation Index
> Fetch the complete documentation index at: https://learn.alphacast.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started with the Alphacast API

> Get your API key, create a repository and a dataset, upload a CSV file, and download the data.

This guide takes you through the core workflow of the REST API with `curl`. Replace the sample IDs with the IDs from your own responses.

> [!NOTE]
>
> API access is available on every plan. Catalog access and download volume depend on your plan. Creating datasets also requires a plan that lets you create assets. Otherwise the API returns `402`. See [pricing](https://www.alphacast.io/pricing).

**1. Get your API key**

Open [your settings](https://www.alphacast.io/settings). Next to **API Key**, click **Show Key**.

Send the key as the HTTP Basic Auth username, with an empty password. The trailing colon tells `curl` that the password is empty.

```bash theme={null}
curl https://api.alphacast.io/repositories \
  -u YOUR_API_KEY:
```

**2. Create a repository**

Every dataset belongs to a repository.

```bash theme={null}
curl -X POST https://api.alphacast.io/repositories \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{"name": "My First Repository", "privacy": "Private"}'
```

The API returns `201`:

```json theme={null}
{
  "id": 42,
  "name": "My First Repository",
  "description": null,
  "privacy": "Private",
  "slug": "my-first-repository-42"
}
```

**3. Create a dataset**

```bash theme={null}
curl -X POST https://api.alphacast.io/datasets \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{"name": "Quarterly GDP", "repositoryId": 42}'
```

The API returns `201`:

```json theme={null}
{
  "id": 101,
  "name": "Quarterly GDP",
  "createdAt": "2026-01-15T10:30:00",
  "repositoryId": 42
}
```

**4. Initialize the columns**

Before the first upload, tell Alphacast which column holds the date and which columns, with the date, identify each row.

```bash theme={null}
curl -X PUT https://api.alphacast.io/datasets/101/columns/initializer \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "dateColumnName": "Date",
    "dateFormat": "%Y-%m-%d",
    "entitiesColumnNames": ["Country"]
  }'
```

You can instead send a [manifest](https://learn.alphacast.io/uploading/manifest.md) with your first upload. An upload to a new dataset with neither returns `400`.

**5. Upload a CSV file**

Save this as `gdp.csv`:

```csv theme={null}
Date,Country,GDP_USD_Billions
2023-01-01,USA,6823.4
2023-04-01,USA,6901.2
2023-07-01,USA,6987.6
```

Then upload it:

```bash theme={null}
curl -X PUT https://api.alphacast.io/datasets/101/data \
  -u YOUR_API_KEY: \
  -F "data=@gdp.csv"
```

The API returns `201` with an upload process:

```json theme={null}
{
  "id": 500,
  "status": "Requested",
  "createdAt": "2026-01-15T10:31:00",
  "datasetId": 101
}
```

**6. Wait for processing**

Uploads are processed in the background. Check the process until `status` is `Processed` or `Error`.

```bash theme={null}
curl https://api.alphacast.io/datasets/101/processes/500 \
  -u YOUR_API_KEY:
```

If the status is `Error`, read `statusDescription`.

**7. Download the data**

The default format is CSV. Use `-L` because the API can answer with a redirect.

```bash theme={null}
curl -L https://api.alphacast.io/datasets/101/data \
  -u YOUR_API_KEY: \
  --output gdp_download.csv
```

Choose another format with `$format`. Put the URL in single quotes so your shell does not expand `$format`.

```bash JSON theme={null}
curl -L 'https://api.alphacast.io/datasets/101/data?$format=json' \
  -u YOUR_API_KEY:
```

```bash XLSX theme={null}
curl -L 'https://api.alphacast.io/datasets/101/data?$format=xlsx' \
  -u YOUR_API_KEY: \
  --output gdp.xlsx
```

```bash TSV theme={null}
curl -L 'https://api.alphacast.io/datasets/101/data?$format=tsv' \
  -u YOUR_API_KEY:
```

To filter, select columns, or paginate, see [Download data](https://learn.alphacast.io/api/datasets/data.md).

## Next steps

> [card] [Authentication](https://learn.alphacast.io/api/authentication.md)
>
> Send and protect your API key.

> [card] [API reference](https://learn.alphacast.io/api/overview.md)
>
> Conventions and endpoint groups.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.