# GET /datasets/{id}/columns — List Dataset Columns
Source: https://learn.alphacast.io/api/datasets/columns
Retrieve just the column schema of a dataset — name, ID, data type, and whether the column is an entity/dimension — without the rest of the dataset metadata.
Returns the column definitions for a dataset as a standalone array. Use this endpoint when you only need to inspect the schema — for example, to build a `$select` list for the [download endpoint](/api/datasets/data) or to validate that a column name exists before referencing it in an OData filter. The full dataset metadata (description, source, date range) is available from [`GET /datasets/{id}`](/api/datasets/get) instead.
## Authentication
Authenticate using HTTP Basic Auth. Pass your API key as the username and leave the password empty. You must have at least `Read` permission on the dataset.
## Request
**Method:** `GET`
**URL:** `https://api.alphacast.io/datasets/{dataset_id}/columns`
## Path parameters
The numeric ID of the dataset whose columns you want to retrieve.
## Response
Returns an array of column definition objects. Each object has the same shape as the entries in the `columns` array returned by [`GET /datasets/{id}`](/api/datasets/get).
Unique column ID. Use this value with `$select` to reference columns reliably across renames.
Column display name.
Data type of the column. One of `Date`, `String`, or `Decimal`.
When `true`, this column is a dimension or index column (e.g., `Date`, `Country`). When `false`, it is a value column.
## Examples
```bash cURL theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/datasets/123/columns
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/datasets/123/columns",
auth=("YOUR_API_KEY", ""),
)
columns = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/datasets/123/columns", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const columns = await response.json();
```
```json 200 theme={null}
[
{ "id": 1, "name": "Date", "dataType": "Date", "isEntity": true },
{ "id": 2, "name": "Country", "dataType": "String", "isEntity": true },
{ "id": 3, "name": "GDP", "dataType": "Decimal", "isEntity": false },
{ "id": 4, "name": "Population", "dataType": "Decimal", "isEntity": false }
]
```
```json 404 theme={null}
{
"message": "Dataset not found"
}
```
## Error responses
| Status | Cause |
| - | - |
| `401 Unauthorized` | No API key provided and the dataset is not publicly accessible. |
| `403 Forbidden` | Your account does not have read access to this dataset. |
| `404 Not Found` | No dataset exists with the given ID. |
To use a column with `$select` on the download endpoint, prefer the numeric `id` over the `name` — IDs are stable across column renames, so download links remain valid even if the schema is reorganised.
# POST /datasets — Create a Dataset
Source: https://learn.alphacast.io/api/datasets/create
Create a new dataset in a repository to store tabular or time-series data. Requires name and repositoryId. Optionally add source metadata.
Creating a dataset registers a named container within a repository where you can then upload tabular or time-series data. You must have at least `Write` permission on the target repository. Once created, upload data to the dataset using `PUT /datasets/{id}/data`.
## Authentication
Authenticate using HTTP Basic Auth. Pass your API key as the username and leave the password empty. You must have `Write` permission on the target repository.
## Request
**Method:** `POST`\
**URL:** `https://api.alphacast.io/datasets`
## Body parameters
The display name for the new dataset. Must be a non-empty string.
The numeric ID of the repository in which to create the dataset. You must have `Write` permission on this repository.
A human-readable description of the dataset's contents, intended audience, or methodology.
The URL of the original data source, for provenance tracking.
The name of the organization or publication that originally produced this data.
## Response
Returns `201 Created` with the newly created dataset object.
The numeric ID assigned to the new dataset. Use this in all subsequent requests.
The name you provided.
The repository the dataset was created in.
The description you provided, or `null` if omitted.
The source name you provided, or `null` if omitted.
The source URL you provided, or `null` if omitted.
Your permission level on the new dataset. Will be `Admin` for datasets you create.
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
-X POST https://api.alphacast.io/datasets \
-H "Content-Type: application/json" \
-d '{
"name": "US GDP Quarterly",
"repositoryId": 45,
"description": "Quarterly US GDP figures from BEA",
"sourceName": "Bureau of Economic Analysis",
"sourceUrl": "https://www.bea.gov/data/gdp"
}'
```
```python Python theme={null}
import requests
response = requests.post(
"https://api.alphacast.io/datasets",
auth=("YOUR_API_KEY", ""),
json={
"name": "US GDP Quarterly",
"repositoryId": 45,
"description": "Quarterly US GDP figures from BEA",
"sourceName": "Bureau of Economic Analysis",
"sourceUrl": "https://www.bea.gov/data/gdp",
},
)
dataset = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/datasets", {
method: "POST",
headers: {
Authorization: "Basic " + btoa("YOUR_API_KEY:"),
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "US GDP Quarterly",
repositoryId: 45,
description: "Quarterly US GDP figures from BEA",
sourceName: "Bureau of Economic Analysis",
sourceUrl: "https://www.bea.gov/data/gdp",
}),
});
const dataset = await response.json();
```
```json 201 theme={null}
{
"id": 123,
"name": "US GDP Quarterly",
"repositoryId": 45,
"description": "Quarterly US GDP figures from BEA",
"sourceName": "Bureau of Economic Analysis",
"sourceUrl": "https://www.bea.gov/data/gdp",
"permission": "Admin",
"frequency": null,
"minDate": null,
"maxDate": null
}
```
## Error responses
| Status | Cause |
| - | - |
| `403 Forbidden` | The repository does not exist, or you do not have `Write` permission on it. |
| `409 Conflict` | A dataset with a conflicting configuration already exists. |
After creating a dataset, use `PUT /datasets/{id}/data` to upload your first CSV file and populate the dataset with rows.
# GET /datasets/{id}/data — Download Dataset Data
Source: https://learn.alphacast.io/api/datasets/data
Download dataset rows as CSV, JSON, XLSX, or TSV. Supports OData filtering, column selection, row limits, and transposing the output.
This endpoint streams the rows of a dataset in your preferred format. For simple downloads with no filters applied in CSV format, the API returns an HTTP `302` redirect to a short-lived pre-signed URL pointing directly to the underlying file in cloud storage — your HTTP client will follow this redirect automatically. When you apply filters, select columns, or request a non-CSV format, the server queries and transforms the data on the fly before returning it.
## Authentication
Authenticate using HTTP Basic Auth with your API key as the username. You can alternatively pass the key as the `apiKey` query parameter. You must have at least `Read` permission on the dataset.
## Request
**Method:** `GET`\
**URL:** `https://api.alphacast.io/datasets/{dataset_id}/data`
## Path parameters
The numeric ID of the dataset to download.
## Query parameters
Your Alphacast API key. Use this as an alternative to HTTP Basic Auth, for example when constructing download links for use in a browser or spreadsheet application.
Output format for the downloaded data. Accepted values: `csv`, `json`, `xlsx`, `tsv`.
When the format is `csv` and no other filters are applied, the API returns a `302` redirect to a pre-signed URL instead of streaming the file directly.
A comma-separated list of column names or column IDs to include in the output. Entity/dimension columns (such as `Date` and `Country`) are always prepended automatically so the result remains well-formed.
Example: `$select=Date,GDP` or `$select=1,3` (using column IDs).
An OData filter expression to restrict the rows returned. Column names are case-sensitive and must match the column names in the dataset schema exactly.
Supported comparison operators: `eq`, `ne`, `gt`, `lt`, `ge`, `le`.\
Supported logical operators: `and`, `or`.
Example: `$filter=Country eq 'USA' and Date ge '2020-01-01'`
Limit the response to the first N rows. When combined with `$filter`, the limit is applied after filtering. When `$top` is set, the response includes a `Row-Count` header with the total number of rows matching any applied filter (before the limit), so you can implement pagination.
Return only the rows corresponding to the last N date periods in the dataset. For example, `$last=100` returns approximately the most recent 100 rows ordered by the date column. When `$last` is set, the response includes a `Row-Count` header with the total row count of the dataset.
When `true`, entity/dimension columns are merged into a single combined column in the output. Useful for pivot-style formats.
When `true`, column IDs are included in the output header row alongside column names.
When `true` and combined with `$select`, rows where all selected value columns are `null` or empty are omitted from the output.
When `true`, the output matrix is transposed: dates become column headers and columns become row labels. When no other filters are active and the format is CSV, a pre-signed URL to a pre-transposed file is returned instead.
A specific version ID to download. Use this to retrieve a historical snapshot of the dataset's data as it existed at a previous point in time.
## Response
When no filters are applied and the format is `csv`, the API responds with `302 Found` and a `Location` header containing a short-lived pre-signed download URL. Your HTTP client will follow this redirect automatically.
When filters are applied or a non-CSV format is requested, the API streams the response directly with the appropriate `Content-Type`.
| Format | Content-Type |
| - | - |
| `csv` | `text/csv` |
| `json` | `application/json` |
| `xlsx` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` |
| `tsv` | `text/tab-separated-values` |
### Row-Count response header
When you use `$top` or `$last`, the response includes a `Row-Count` header with the total untruncated row count:
```
Row-Count: 4823
Access-Control-Expose-Headers: Row-Count
```
Use this value to display pagination metadata or calculate how many more pages of data remain.
## OData filter syntax
The `$filter` parameter accepts OData filter expressions. Column names must exactly match the column names shown in the dataset schema (use `GET /datasets/{id}` to retrieve the schema).
| Operator | Meaning | Example |
| - | - | - |
| `eq` | Equal | `Country eq 'USA'` |
| `ne` | Not equal | `Country ne 'Canada'` |
| `gt` | Greater than | `GDP gt 1000` |
| `lt` | Less than | `GDP lt 5000` |
| `ge` | Greater than or equal | `Date ge '2020-01-01'` |
| `le` | Less than or equal | `Date le '2024-12-31'` |
| `and` | Logical AND | `Country eq 'USA' and Date ge '2020-01-01'` |
| `or` | Logical OR | `Country eq 'USA' or Country eq 'Canada'` |
String values must be enclosed in single quotes. Date values must use `YYYY-MM-DD` format.
Filtering is validated against the dataset's column schema. If you reference a column name that does not exist in the dataset, the API returns `400 Bad Request` listing the invalid column names.
## Examples
**Basic download — returns a 302 redirect to a pre-signed CSV URL:**
```bash cURL theme={null}
curl -u YOUR_API_KEY: -L \
https://api.alphacast.io/datasets/123/data \
--output data.csv
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/datasets/123/data",
auth=("YOUR_API_KEY", ""),
allow_redirects=True,
)
with open("data.csv", "wb") as f:
f.write(response.content)
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/datasets/123/data", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
redirect: "follow",
});
const csv = await response.text();
```
**Filter by country:**
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/datasets/123/data?\$filter=Country%20eq%20'USA'"
```
**Select specific columns:**
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/datasets/123/data?\$select=Date,GDP"
```
**Return only the last 100 rows by date:**
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/datasets/123/data?\$last=100"
```
**Download as JSON:**
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/datasets/123/data?\$format=json"
```
**Combine a date filter with a country filter and return JSON:**
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/datasets/123/data?\$format=json&\$filter=Country%20eq%20'USA'%20and%20Date%20ge%20'2020-01-01'"
```
## Error responses
| Status | Cause |
| - | - |
| `400 Bad Request` | The `$filter` expression could not be parsed, or references a column that does not exist in the dataset. |
| `401 Unauthorized` | No API key provided and the dataset is not publicly accessible. |
| `403 Forbidden` | Your account's membership does not include dataset download permissions. |
To construct a shareable download link for use in Excel or Google Sheets, pass your API key via the `apiKey` query parameter and set `$format=csv`. The link will redirect to a pre-signed URL valid for a short time window.
# DELETE /datasets/{id} — Delete a Dataset
Source: https://learn.alphacast.io/api/datasets/delete
Permanently delete a dataset and all its data. Requires Write permission on the dataset. Returns 204 No Content. This action cannot be undone.
Deleting a dataset permanently removes it along with all uploaded data and column definitions. You must have `Write` permission on the dataset to perform this action. There is no confirmation step and no way to recover a deleted dataset, so proceed with care.
## Authentication
Authenticate using HTTP Basic Auth. Pass your API key as the username and leave the password empty. You must have `Write` permission on the target dataset.
## Request
**Method:** `DELETE`\
**URL:** `https://api.alphacast.io/datasets/{dataset_id}`
## Path parameters
The numeric ID of the dataset to delete.
## Response
Returns `204 No Content` with an empty body on success.
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
-X DELETE https://api.alphacast.io/datasets/123
```
```python Python theme={null}
import requests
response = requests.delete(
"https://api.alphacast.io/datasets/123",
auth=("YOUR_API_KEY", ""),
)
assert response.status_code == 204
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/datasets/123", {
method: "DELETE",
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
// response.status === 204
```
A successful deletion produces no response body and returns HTTP `204`.
## Error responses
| Status | Cause |
| - | - |
| `401 Unauthorized` | Missing or invalid API key. |
| `403 Forbidden` | You do not have `Write` permission on this dataset. |
| `404 Not Found` | No dataset with the given ID exists or is accessible to your account. |
Deletion is permanent. All rows, column definitions, and metadata associated with this dataset are destroyed immediately. This action cannot be undone.
# GET /datasets/{id} — Get a Dataset
Source: https://learn.alphacast.io/api/datasets/get
Retrieve a single dataset by numeric ID, including its name, repository, description, column schema, date range, and your permission level.
Use this endpoint to retrieve full metadata for a specific dataset, including its column definitions and date range. This is useful before downloading data, as it lets you inspect the available columns and verify you have the right dataset. A supplementary endpoint, `GET /datasets/{id}/date-stats`, returns precise frequency and date-range information computed directly from the stored data.
## Authentication
Authenticate using HTTP Basic Auth. Pass your API key as the username and leave the password empty.
## Endpoints
| Method | URL | Description |
| - | - | - |
| `GET` | `/datasets/{dataset_id}` | Retrieve dataset metadata |
| `GET` | `/datasets/{dataset_id}/date-stats` | Retrieve inferred frequency and date range |
## Path parameters
The numeric ID of the dataset to retrieve.
## Get dataset metadata
```bash cURL theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/datasets/123
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/datasets/123",
auth=("YOUR_API_KEY", ""),
)
dataset = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/datasets/123", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const dataset = await response.json();
```
### Response
Unique numeric identifier for the dataset.
Display name of the dataset.
ID of the repository this dataset belongs to.
Optional human-readable description.
Name of the original data source.
URL linking to the original data source.
Your permission level: `Read`, `Write`, or `Admin`.
Inferred data frequency (e.g., `monthly`, `quarterly`, `daily`). May be `null` if not yet computed.
Earliest date in the dataset (`YYYY-MM-DD`). May be `null` for empty datasets.
Latest date in the dataset (`YYYY-MM-DD`). May be `null` for empty datasets.
Array of column definition objects describing the dataset schema.
Unique column ID. Use this value with `$select` to reference columns reliably across renames.
Column display name.
Data type of the column. One of `Date`, `String`, or `Decimal`.
When `true`, this column is a dimension or index column (e.g., `Date`, `Country`). When `false`, it is a value column.
### Example response
```json theme={null}
{
"id": 123,
"name": "US GDP Quarterly",
"repositoryId": 45,
"description": "Quarterly US GDP figures from BEA",
"sourceName": "Bureau of Economic Analysis",
"sourceUrl": "https://www.bea.gov/data/gdp",
"permission": "Admin",
"frequency": "quarterly",
"minDate": "1947-01-01",
"maxDate": "2024-10-01",
"columns": [
{ "id": 1, "name": "Date", "dataType": "Date", "isEntity": true },
{ "id": 2, "name": "Country", "dataType": "String", "isEntity": true },
{ "id": 3, "name": "GDP", "dataType": "Decimal", "isEntity": false }
]
}
```
## Get date statistics
The `/date-stats` endpoint returns frequency and date range information computed live from the dataset's stored data. If the dataset record already has a cached `frequency`, `minDate`, and `maxDate`, those cached values are returned immediately. Otherwise, the values are computed from the column data on demand.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/datasets/123/date-stats
```
### Response
The inferred data frequency, such as `monthly`, `quarterly`, or `daily`.
The earliest date found in the dataset (`YYYY-MM-DD`).
The latest date found in the dataset (`YYYY-MM-DD`).
### Example response
```json theme={null}
{
"inferedFreq": "quarterly",
"minDate": "1947-01-01",
"maxDate": "2024-10-01"
}
```
The `/date-stats` endpoint supports optional authentication. Public datasets can be queried without an API key, while private datasets require authentication.
# GET /datasets — List All Datasets
Source: https://learn.alphacast.io/api/datasets/list
Retrieve all datasets accessible to the authenticated user across all repositories. Returns an array of dataset objects with metadata.
The list endpoint returns every dataset your account can access, spanning all repositories you own or have been granted permission to view. Use this endpoint to discover available datasets, check their names and IDs, and determine which repository each dataset belongs to before fetching its data.
## Authentication
Authenticate using HTTP Basic Auth. Pass your API key as the username and leave the password empty.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/datasets
```
## Request
**Method:** `GET`\
**URL:** `https://api.alphacast.io/datasets`
No query parameters or request body are required.
## Response
Returns a JSON array of dataset objects. Each object represents one dataset accessible to your account.
Unique numeric identifier for the dataset.
Display name of the dataset.
ID of the repository this dataset belongs to.
Optional human-readable description of the dataset's contents.
Name of the original data source, if provided at creation time.
URL linking to the original data source, if provided at creation time.
Your permission level on this dataset. One of `Read`, `Write`, or `Admin`.
Inferred data frequency of the dataset (e.g., `monthly`, `daily`). May be `null` if not yet determined.
Earliest date present in the dataset, in `YYYY-MM-DD` format. May be `null` if the dataset is empty.
Latest date present in the dataset, in `YYYY-MM-DD` format. May be `null` if the dataset is empty.
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/datasets
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/datasets",
auth=("YOUR_API_KEY", ""),
)
datasets = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/datasets", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const datasets = await response.json();
```
```json 200 theme={null}
[
{
"id": 123,
"name": "US GDP Quarterly",
"repositoryId": 45,
"description": "Quarterly US GDP figures from BEA",
"sourceName": "Bureau of Economic Analysis",
"sourceUrl": "https://www.bea.gov/data/gdp",
"permission": "Admin",
"frequency": "quarterly",
"minDate": "1947-01-01",
"maxDate": "2024-10-01"
},
{
"id": 124,
"name": "CPI Monthly",
"repositoryId": 45,
"description": null,
"sourceName": null,
"sourceUrl": null,
"permission": "Read",
"frequency": "monthly",
"minDate": "2000-01-01",
"maxDate": "2024-11-01"
}
]
```
This endpoint returns only datasets your account has at least `Read` permission on. Datasets in repositories you cannot access are not included in the response.
# PUT /datasets/{id}/data — Upload Data to a Dataset
Source: https://learn.alphacast.io/api/datasets/upload
Upload a CSV or gzip-compressed CSV file to add, update, or replace dataset rows. Supports a column manifest, conflict resolution flags, and async processing.
Use this endpoint to load rows into a dataset by uploading a CSV file. The upload is processed asynchronously: the request returns immediately with a process record, and the rows become available in the dataset once the background job completes.
This page is the API reference. For the concepts behind the request — what a manifest is, what gets validated, and how the conflict-resolution flags interact — see the [Uploading Data](/uploading/overview) section.
## Authentication
Authenticate using HTTP Basic Auth. Pass your API key as the username and leave the password empty. You must have at least `Write` permission on the target dataset.
## Request
**Method:** `PUT`\
**URL:** `https://api.alphacast.io/datasets/{dataset_id}/data`\
**Content-Type:** `multipart/form-data`
## Path parameters
The numeric ID of the dataset to upload data into.
## Form fields
The CSV file to upload. Accepts plain `.csv` files or gzip-compressed `.csv.gz` files. The first row must be a header row containing column names.
A JSON string declaring each column's data type and entity flag. Required on the dataset's first upload (or set the manifest beforehand from the web UI). On subsequent uploads it is optional — pass it only when you want to replace the dataset's stored manifest. See the [Manifest reference](/uploading/manifest) for the full schema.
## Query parameters
When `true`, rows present in the existing dataset but absent from the upload are deleted. Use this to perform a full replacement. Forced to `false` if the dataset's manifest is locked. See [Upload modes](/uploading/validation#upload-modes).
When `true`, rows whose entity key matches an existing row are updated with the new value. When `false`, the existing value is kept and the upload's value is discarded for those rows.
When `true`, columns in the CSV that are not in the dataset's existing schema are added. When `false`, unknown columns cause the upload to fail with `Unknown column(s): ...`. Forced to `false` if the manifest is locked.
## Response
Returns `201 Created` with a process object describing the background upload job.
The ID of the upload process. Use this to poll the dataset processes endpoint and inspect status, stats, and any error message.
Initial status — typically `Requested`. Transitions to `Processing` → `Processed` (or `Error`) as the background worker runs. See the [upload lifecycle](/uploading/overview#the-upload-lifecycle).
## Example
Upload a CSV file with a manifest:
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
-X PUT https://api.alphacast.io/datasets/123/data \
-F "data=@gdp_data.csv" \
-F 'manifest=[{"sourceName":"Date","dataType":"Date","isEntity":true},{"sourceName":"Country","dataType":"String","isEntity":true},{"sourceName":"GDP","dataType":"Decimal","isEntity":false}]'
```
```python Python theme={null}
import json
import requests
manifest = [
{"sourceName": "Date", "dataType": "Date", "isEntity": True},
{"sourceName": "Country", "dataType": "String", "isEntity": True},
{"sourceName": "GDP", "dataType": "Decimal", "isEntity": False},
]
with open("gdp_data.csv", "rb") as f:
response = requests.put(
"https://api.alphacast.io/datasets/123/data",
auth=("YOUR_API_KEY", ""),
files={"data": ("gdp_data.csv", f, "text/csv")},
data={"manifest": json.dumps(manifest)},
)
process = response.json()
```
```javascript Node.js theme={null}
import fs from "node:fs";
const manifest = [
{ sourceName: "Date", dataType: "Date", isEntity: true },
{ sourceName: "Country", dataType: "String", isEntity: true },
{ sourceName: "GDP", dataType: "Decimal", isEntity: false },
];
const form = new FormData();
form.append("data", new Blob([fs.readFileSync("gdp_data.csv")]), "gdp_data.csv");
form.append("manifest", JSON.stringify(manifest));
const response = await fetch("https://api.alphacast.io/datasets/123/data", {
method: "PUT",
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
body: form,
});
const process = await response.json();
```
Upload a gzip-compressed CSV and replace any existing row not present in the file:
```bash theme={null}
curl -u YOUR_API_KEY: \
-X PUT "https://api.alphacast.io/datasets/123/data?deleteMissingFromDB=true&onConflictUpdateDB=true" \
-F "data=@gdp_data.csv.gz"
```
Upload a plain CSV and allow new columns to extend the schema:
```bash theme={null}
curl -u YOUR_API_KEY: \
-X PUT "https://api.alphacast.io/datasets/123/data?acceptNewColumns=true" \
-F "data=@gdp_data.csv"
```
## Error responses
The API surfaces validation errors via the upload process record (status `Error`, `statusDescription` set to the message). The HTTP response itself uses standard codes:
| Status | Cause |
| - | - |
| `400 Bad Request` | The manifest is malformed, or required form fields are missing. |
| `401 Unauthorized` | Missing or invalid API key. |
| `403 Forbidden` | You do not have `Write` permission on this dataset. |
| `404 Not Found` | No dataset with the given ID exists or is accessible to your account. |
For row-level validation failures (`Data has not Date column`, duplicate rows, out-of-range Short Integer, etc.) the HTTP call returns `201` with a process record, and the failure surfaces when the process transitions to `Error`. See [Validation rules](/uploading/validation#validation-rules) for the complete list.
When `deleteMissingFromDB` is `true`, any row in the existing dataset whose key does not appear in the uploaded file is permanently deleted. Verify your file contains every row you wish to keep before setting this flag.
Uploads are processed asynchronously. The API returns immediately with a process object, and the data becomes available in the dataset once the background job completes. Identical re-uploads (same content + same flags as the previous successful run) are detected via a content hash and skipped — see [Idempotency](/uploading/overview#idempotency-identical-content-is-skipped).
# API Error Codes and Troubleshooting
Source: https://learn.alphacast.io/api/errors
Reference for every HTTP error code returned by the Alphacast API — 400, 401, 402, 403, 404, 409, 429, 500, 503, 504 — with causes, example responses, and fixes.
When an API request fails, Alphacast returns a standard HTTP error status code and, where possible, a JSON body that describes what went wrong. This page covers every error code you may encounter, what typically causes it, and how to fix it.
## Error response format
Most error responses follow this shape:
```json theme={null}
{
"error": "Description of what went wrong"
}
```
Some errors — particularly `401` and `500` — may return an empty body or a plain-text message depending on where in the request lifecycle the failure occurs.
## Error codes
### 400 Bad Request
Your request was understood but contained invalid or missing data.
```json theme={null}
{
"error": "repositoryId is required"
}
```
**Common causes:**
* A required field is missing from the request body. For example, creating a dataset without providing `repositoryId`.
* The request body is malformed JSON. Verify that your payload is valid and that you have set `Content-Type: application/json`.
* An OData `$filter` expression references a column that does not exist in the dataset. The error message will look like:
```json theme={null}
{
"error": "Filter contains invalid column(s): region"
}
```
Check the column names in the dataset exactly as they appear — column names are case-sensitive.
***
### 401 Unauthorized
Your request did not include valid credentials, or no credentials were provided at all.
**Common causes and fixes:**
* **Missing API key** — Include your API key via HTTP Basic Auth or the `?apiKey=` query parameter. See the [API overview](/api/overview) for the correct format.
* **Key in the wrong field** — When using Basic Auth, the API key must be the **username**, not the password. A common mistake is reversing these:
```bash theme={null}
# Correct
curl -u YOUR_API_KEY: https://api.alphacast.io/repositories
# Incorrect — key is in the password field
curl -u :YOUR_API_KEY https://api.alphacast.io/repositories
```
* **Invalid or revoked key** — Verify your key in Alphacast account settings. If you recently regenerated it, update any integrations that use the old key.
***
### 402 Payment Required
The action you attempted requires a higher membership tier than your current plan provides.
```json theme={null}
{
"error": "This action requires a membership upgrade."
}
```
**Common causes:**
* Creating an additional private repository beyond your plan's limit.
* Fetching data from a paid-tier provider while on a free plan.
* Downloading data that exceeds your plan's monthly export quota.
**Fix:** upgrade your Alphacast subscription, or remove an existing resource to free up quota.
***
### 403 Forbidden
Your credentials are valid, but you do not have permission to perform this action on the requested resource.
**Common causes:**
* You are attempting to write to (or delete from) a repository where you only have **Read** permission. Contact the repository owner to request Write access.
* You are trying to access a private resource that belongs to another account.
***
### 404 Not Found
The resource you requested does not exist.
```json theme={null}
{
"error": "Not found"
}
```
**Common causes:**
* The dataset or repository ID in the URL is wrong. Double-check the ID in the Alphacast UI or via a `GET /datasets` list request.
* The resource was deleted after you last retrieved its ID.
***
### 409 Conflict
The request could not be completed because it conflicts with an existing resource.
```json theme={null}
{
"error": "A dataset named 'CPI Monthly' already exists in repository 45."
}
```
**Common causes:**
* Creating a dataset with a name that already exists in the same repository.
* Uploading data with a column manifest that conflicts with the dataset's existing column types.
* Saving a provider API key while another concurrent request is updating the same key.
**Fix:** rename the resource, delete the existing one, or retry once the conflicting request completes.
***
### 429 Too Many Requests
You hit a rate limit. Alphacast does not enforce a global API limit, but the provider connectors honor each upstream's limits on your behalf — if FRED, BLS, or any other source caps requests per minute or per day, Alphacast surfaces that as a `429`.
```json theme={null}
{
"error": "Upstream provider rate limit exceeded for fred. Try again in a few seconds."
}
```
**Common causes and fixes:**
* The upstream provider's rate limit was reached. Save your own API key with `PUT /user-keys/{slug}` to raise the limit (especially for FRED and BLS, which are far more generous with an authenticated key).
* Many concurrent series fetches against the same provider. Serialize the calls or add backoff.
***
### 500 Internal Server Error
An unexpected error occurred on the server. This is not caused by your request.
**What to do:**
* Wait a moment and retry the request — transient errors often resolve on their own.
* If the error persists, note the endpoint, request body, and approximate time of the failure, then contact Alphacast support.
For errors that originate inside a provider connector, the response message is **sanitized** — it does not include upstream URLs, internal tokens, or stack traces. The unredacted detail is kept in Alphacast's server logs, so include the endpoint and timestamp when filing a support request.
A `500` response is never caused by invalid input in your request. If you see one consistently for the same request, it is a server-side issue worth reporting.
***
### 503 Service Unavailable
The API is temporarily unable to handle the request, typically because of a deploy in progress or an overloaded backend dependency.
**What to do:** retry with exponential backoff. Most `503` responses clear within a few seconds.
***
### 504 Gateway Timeout
The request took longer than the gateway timeout to complete. Most often this happens on long-running operations such as fetching the full history of a large provider series, or downloading a very wide dataset.
**What to do:**
* Narrow the response: pass `$top`, `$last`, or `$filter` to `GET /datasets/{id}/data`, or restrict the date range when fetching provider series.
* Retry the same request after a short delay — transient timeouts often resolve.
## Debugging checklist
If you are not sure which error applies to your situation, work through this checklist:
1. **Check the status code** — The HTTP status in the response headers is always the authoritative signal.
2. **Read the error message** — The `error` field in the JSON body usually describes the problem specifically.
3. **Confirm authentication** — Re-run the request with `curl -v` to inspect the `Authorization` header being sent.
4. **Validate your JSON** — Paste your request body into a JSON validator to catch syntax errors before sending.
5. **Verify resource IDs** — Fetch the parent resource (e.g., `GET /repositories`) to confirm the IDs you are using still exist.
6. **Check column names in filters** — If using `$filter`, list the dataset columns first with `GET /datasets/{id}/columns` to confirm exact names.
# Alphacast REST API Reference
Source: https://learn.alphacast.io/api/overview
Explore the Alphacast REST API to manage repositories, datasets, and data providers programmatically from any HTTP client.
The Alphacast API gives you programmatic access to the same data and workflows available in the Alphacast platform. You can list and create repositories, upload and query datasets, and browse data providers — all over standard HTTP. Every response is JSON, and authentication uses your personal API key.
## Base URL
All API requests go to the following base URL:
```
https://api.alphacast.io
```
## Authentication
The API supports two authentication methods. Both accept the same API key, which you can find in your Alphacast account settings.
**HTTP Basic Auth (recommended)**
Pass your API key as the HTTP Basic Auth username. Leave the password field empty.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/repositories
```
Your API key goes in the **username** field, not the password field. The trailing colon in `-u YOUR_API_KEY:` tells curl to send an empty password — this is intentional.
**Query parameter**
You can also pass your API key as a query parameter. This is convenient for quick testing but less secure because the key appears in URLs and server logs.
```bash theme={null}
curl "https://api.alphacast.io/repositories?apiKey=YOUR_API_KEY"
```
For production integrations, use HTTP Basic Auth or the [Alphacast Python SDK](/python-sdk/overview) which handles authentication for you.
## Path conventions
Provider and user-key slugs in path parameters (`/providers/{slug}`, `/user-keys/{slug}`) are **case-insensitive**. `FRED`, `fred`, and `Fred` all resolve to the same provider, so you do not need to normalize casing on the client.
Series IDs in `/providers/{slug}/series/{series_id}` may contain forward slashes (for example, SDMX-style dataflow paths). See the [fetch series reference](/api/providers/series) for examples.
## Request format
For `POST` and `PUT` requests, send a JSON body with the `Content-Type: application/json` header:
```bash theme={null}
curl -u YOUR_API_KEY: \
-X POST \
-H "Content-Type: application/json" \
-d '{"name": "My Dataset", "repositoryId": 42}' \
https://api.alphacast.io/datasets
```
## Data export formats
When downloading dataset data from `GET /datasets/{id}/data`, you can control the output format with the `$format` query parameter:
| Format | Value | Notes |
| - | - | - |
| CSV | `csv` | Default if `$format` is omitted |
| JSON | `json` | — |
| Excel | `xlsx` | — |
| TSV | `tsv` | Tab-separated values |
```bash theme={null}
# Download as Excel
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/datasets/123/data?\$format=xlsx" \
--output data.xlsx
```
## Pagination
Most listing endpoints (`GET /repositories`, `GET /datasets`, `GET /providers`) return the full set of results your API key can access, without server-side paging. Filter the response client-side using the fields described on each endpoint page.
Two endpoints expose explicit pagination controls:
| Endpoint | Parameters | Notes |
| - | - | - |
| `GET /datasets/{id}/data` | `$top`, `$last`, `$filter` | When `$top` or `$last` is set, the response includes a `Row-Count` header with the total row count before truncation. Use it to drive pagination UI. |
| `GET /providers/{slug}/browse?series=true` | `limit` (max `1000`, default `200`), `offset` | Standard limit/offset paging when listing series under a provider category. |
## Idempotency
Idempotency follows standard HTTP semantics:
* **`GET`**, **`PUT`**, and **`DELETE`** are idempotent. Repeating the same request produces the same final state.
* **`POST`** is **not** idempotent. Retrying a `POST /repositories` or `POST /datasets` creates a new resource each time. Treat client-side retries with care; on network errors, prefer `GET` to verify whether the previous request succeeded before retrying.
The API does not currently honor an `Idempotency-Key` header. If you need at-most-once semantics for a `POST`, deduplicate at the client by checking for an existing resource with the same name before retrying.
## Rate limits
Alphacast does not enforce a global rate limit on the API. However, some third-party data providers impose their own restrictions, which Alphacast respects on your behalf. When an upstream limit is hit, the API returns **`429 Too Many Requests`** with an error message naming the provider. For example, FRED inherits its public rate limit; BLS allows up to **25 requests per day** without a registered BLS API key.
If you exceed an upstream limit, requests to that provider's data will fail with `429` until the limit resets. Other providers are not affected.
Raise an upstream limit by saving your own API key for that provider with `PUT /user-keys/{slug}`. For BLS, register for a free key at [bls.gov](https://www.bls.gov/developers/); for FRED, at [fred.stlouisfed.org](https://fred.stlouisfed.org/docs/api/api_key.html).
## API resources
The Alphacast API is organized into the resource groups below. Each group has its own reference page with full endpoint listings, parameters, and example responses.
Create and manage repositories, which are the top-level containers for organizing your datasets.
Upload, query, and manage datasets — including column configuration, data versioning, and export formats.
Browse and query external financial data providers such as FRED, BLS, and market data sources.
# GET /providers — List and Browse Data Providers
Source: https://learn.alphacast.io/api/providers/list
List all available data providers, browse their hierarchical categories, search for series, and save provider API keys for authenticated access.
The Alphacast provider API gives you a unified interface to discover and navigate data from dozens of official statistical agencies, central banks, and financial data sources. You can list all providers, inspect their capabilities, browse hierarchical category trees, search for specific series within a provider, and manage the provider API keys that some sources require.
## Authentication
All provider endpoints use HTTP Basic Auth. Pass your Alphacast API key as the username with an empty password.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/providers
```
Most listing and browse endpoints work without authentication, but authenticated requests are required to manage provider API keys via `/user-keys`.
***
## Endpoints
### GET /providers
Returns the full catalog of available data providers. Use this to discover slugs, understand each provider's capabilities, and check licensing terms before fetching data.
```bash cURL theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/providers
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/providers",
auth=("YOUR_API_KEY", ""),
)
providers = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/providers", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const providers = await response.json();
```
**Response fields**
Unique identifier for the provider. Use this as the `{slug}` path parameter in all other provider endpoints. Examples: `fred`, `bls`, `worldbank`, `bcra`.
Human-readable name of the data collection. Examples: `FRED Economic Data`, `BLS Public Data`.
Name of the organization that publishes the data. Examples: `Federal Reserve Bank of St. Louis`, `U.S. Bureau of Labor Statistics`.
Short description of what the provider covers — topics, geography, and data types.
List of supported operations for this provider. Possible values:
* `"hierarchical"` — supports category browsing via `GET /providers/{slug}/browse`
* `"search"` — supports free-text series search via `GET /providers/{slug}/search`
* `"direct"` — supports fetching a series directly by ID
Data license or usage terms. Examples: `Public Domain`, `Creative Commons Attribution 4.0 (CC-BY 4.0)`.
**Example response**
```json theme={null}
[
{
"slug": "fred",
"name": "FRED Economic Data",
"provider": "Federal Reserve Bank of St. Louis",
"description": "Hundreds of thousands of economic time series from dozens of national, international, public, and private sources.",
"capabilities": ["search", "hierarchical", "direct"],
"license": "Public Domain (mostly)"
},
{
"slug": "worldbank",
"name": "World Bank Open Data",
"provider": "The World Bank",
"description": "Global development indicators covering economics, health, education, environment, and more for 200+ countries.",
"capabilities": ["hierarchical", "direct"],
"license": "Creative Commons Attribution 4.0 (CC-BY 4.0)"
},
{
"slug": "bls",
"name": "BLS Public Data",
"provider": "U.S. Bureau of Labor Statistics",
"description": "Employment, wages, inflation, and productivity statistics from the U.S. federal statistical agency.",
"capabilities": ["hierarchical", "search", "direct"],
"license": "Public Domain"
}
]
```
***
### GET /providers/match
Performs a keyword search across all providers and returns the top 5 matches with full detail. This endpoint is designed for programmatic discovery — for example, when you want to find which provider carries a certain type of data without knowing its slug in advance.
**Query parameters**
Free-text search query. Matched against each provider's slug, name, organization name, and description. Multiple words are scored independently — a provider matching more terms ranks higher.
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/providers/match?q=argentina+inflation"
```
**Response fields**
Each item in the returned array includes all fields from `/providers` plus the following additional fields when the provider requires an API key:
List of configurable parameters for the provider (same structure as in provider detail).
Curated list of commonly used series IDs and labels for this provider.
Present and `true` when the provider requires you to supply your own API key from the upstream source.
Present when `api_key_required` is `true`. Indicates whether you have already saved an API key for this provider via `/user-keys/{slug}`.
Human-readable label for the key field, such as `"FRED API Key"` or `"INEGI API Token"`.
Message explaining any access limitations when no key is provided. Example: `"A FRED API key is required. Get one for free."`.
***
### GET /providers/
Returns full detail for a single provider including its configurable parameters, a curated list of popular series, and whether you have a stored API key for it.
**Path parameters**
Provider slug. Use the `slug` field from `GET /providers`. Matching is **case-insensitive** — `fred`, `FRED`, and `Fred` all resolve to the same provider.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/providers/fred
```
**Response fields**
Provider slug.
Display name.
Publishing organization name.
Description of the data covered.
Supported operations: `"hierarchical"`, `"search"`, `"direct"`.
Provider-specific parameters you can pass when fetching series data. Each parameter object includes:
Parameter key to use in the request body or query string.
Human-readable label.
Input type: `"number"`, `"text"`, `"select"`.
Where the parameter is sent: `"body"`, `"query"`, or `"header"`.
Default value when not specified.
For `"select"` type parameters, the list of allowed values. Each entry has `code` and `label`.
Curated series suggestions. Each item has `id` (the series ID) and `label` (a descriptive name).
Data license.
URL where you can register for an API key with the upstream provider, if applicable.
Label for the API key field.
Message describing rate limits or access restrictions without a key.
Display name for the root level of the provider's category tree. Example: `"Categories"` for FRED, `"Topics"` for World Bank.
Example series ID format for this provider. Example: `"e.g. GDP, UNRATE, CPIAUCSL"` for FRED.
Whether your account has a stored API key for this provider. Always present; `false` when you are unauthenticated.
**Example response**
```json theme={null}
{
"slug": "fred",
"name": "FRED Economic Data",
"provider": "Federal Reserve Bank of St. Louis",
"description": "Hundreds of thousands of economic time series from dozens of national, international, public, and private sources.",
"capabilities": ["search", "hierarchical", "direct"],
"parameters": [
{
"key": "units",
"label": "Units",
"type": "select",
"location": "query",
"default": "lin",
"values": [
{"code": "lin", "label": "Levels"},
{"code": "chg", "label": "Change"},
{"code": "pch", "label": "% Change"},
{"code": "pc1", "label": "% Change from Year Ago"},
{"code": "log", "label": "Log"}
]
},
{
"key": "frequency",
"label": "Frequency",
"type": "select",
"location": "query",
"default": "",
"values": [
{"code": "", "label": "Native (no resampling)"},
{"code": "a", "label": "Annual"},
{"code": "q", "label": "Quarterly"},
{"code": "m", "label": "Monthly"}
]
}
],
"popular_series": [
{"id": "GDP", "label": "Gross Domestic Product"},
{"id": "UNRATE", "label": "Unemployment Rate"},
{"id": "CPIAUCSL", "label": "Consumer Price Index for All Urban Consumers"},
{"id": "FEDFUNDS", "label": "Federal Funds Effective Rate"},
{"id": "DGS10", "label": "10-Year Treasury Constant Maturity Rate"}
],
"license": "Public Domain (mostly)",
"api_key_url": "https://fred.stlouisfed.org/docs/api/api_key.html",
"api_key_label": "FRED API Key",
"anonymous_limit_message": "A FRED API key is required. Get one for free.",
"browse_root_label": "Categories",
"series_id_placeholder": "e.g. GDP, UNRATE, CPIAUCSL",
"has_user_api_key": true
}
```
***
### GET /providers//browse
Navigates the hierarchical category structure of a provider. Only available for providers with the `"hierarchical"` capability. Use this to drill down through topics, surveys, or indicator categories before fetching individual series.
Calling this endpoint on a provider without the `"hierarchical"` capability returns a `400` error. Check the `capabilities` array in `GET /providers` before using browse.
**Path parameters**
Provider slug.
**Query parameters**
Slash-separated navigation path within the provider's category tree. Omit or leave empty to start from the root. Example: `"National Accounts/GDP"`.
How many levels of the tree to prefetch in a single request. Maximum is `3`. Use `depth=1` (the default) to retrieve only the immediate children of the current path.
When `true`, returns paginated series at the current path instead of sub-folders.
Page size when `series=true`. Maximum is `1000`.
Pagination offset when `series=true`.
```bash theme={null}
# Browse the root of the World Bank topic tree
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/providers/worldbank/browse"
# Navigate into a specific topic, two levels deep
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/providers/worldbank/browse?path=Economy%20%26%20Growth&depth=2"
```
**Example response (root browse)**
```json theme={null}
[
{"label": "Economy & Growth", "path": "Economy & Growth"},
{"label": "Education", "path": "Education"},
{"label": "Energy & Mining", "path": "Energy & Mining"},
{"label": "Environment", "path": "Environment"},
{"label": "Financial Sector", "path": "Financial Sector"},
{"label": "Health", "path": "Health"},
{"label": "Social Development", "path": "Social Development"}
]
```
***
### GET /providers//search
Searches for series within a specific provider by keyword. Only available for providers with the `"search"` capability.
**Path parameters**
Provider slug.
**Query parameters**
Search query string. Returns `{"items": []}` when the query is empty.
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/providers/fred/search?q=unemployment+rate"
```
**Response fields**
The search query that was submitted.
Array of matching series. Each item typically includes the series ID and a descriptive label. The exact structure depends on the provider's search implementation.
**Example response**
```json theme={null}
{
"query": "unemployment rate",
"items": [
{"id": "UNRATE", "label": "Unemployment Rate"},
{"id": "UNRATENSA", "label": "Unemployment Rate (Not Seasonally Adjusted)"},
{"id": "LNS14000006", "label": "Unemployment Rate - Black or African American"},
{"id": "LNS14000003", "label": "Unemployment Rate - Hispanic or Latino"}
]
}
```
***
## User API key management
Some providers — such as FRED, INEGI, and BLS — require you to register for an API key directly with the upstream data source. You can store that key in your Alphacast account so it is applied automatically whenever you fetch data from that provider.
### GET /user-keys
Returns which providers you currently have API keys stored for. The actual key values are masked; only presence is indicated.
This endpoint requires authentication. Unauthenticated requests will fail.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/user-keys
```
**Example response**
```json theme={null}
{
"fred": true,
"bls": true
}
```
Each key in the response object is a provider slug. A value of `true` means you have a stored key for that provider.
***
### PUT /user-keys/
Saves or deletes your API key for a specific provider. Send the key as `api_key` in the JSON body. Send `null` or an empty string to remove a previously stored key.
**Path parameters**
Provider slug. Must match an existing provider in the catalog.
**Request body**
Your API key for the upstream provider. Pass `null` or omit the field to delete the stored key.
```bash cURL theme={null}
# Save a FRED API key
curl -u YOUR_API_KEY: \
-X PUT https://api.alphacast.io/user-keys/fred \
-H "Content-Type: application/json" \
-d '{"api_key": "your-fred-api-key-here"}'
# Remove the stored FRED API key
curl -u YOUR_API_KEY: \
-X PUT https://api.alphacast.io/user-keys/fred \
-H "Content-Type: application/json" \
-d '{"api_key": null}'
```
```python Python theme={null}
import requests
# Save a FRED API key
requests.put(
"https://api.alphacast.io/user-keys/fred",
auth=("YOUR_API_KEY", ""),
json={"api_key": "your-fred-api-key-here"},
)
# Remove the stored FRED API key
requests.put(
"https://api.alphacast.io/user-keys/fred",
auth=("YOUR_API_KEY", ""),
json={"api_key": None},
)
```
```javascript Node.js theme={null}
// Save a FRED API key
await fetch("https://api.alphacast.io/user-keys/fred", {
method: "PUT",
headers: {
Authorization: "Basic " + btoa("YOUR_API_KEY:"),
"Content-Type": "application/json",
},
body: JSON.stringify({ api_key: "your-fred-api-key-here" }),
});
// Remove the stored FRED API key
await fetch("https://api.alphacast.io/user-keys/fred", {
method: "PUT",
headers: {
Authorization: "Basic " + btoa("YOUR_API_KEY:"),
"Content-Type": "application/json",
},
body: JSON.stringify({ api_key: null }),
});
```
**Response fields**
Provider slug that was updated.
`true` if a key is now stored, `false` if the key was removed.
**Example response**
```json theme={null}
{
"slug": "fred",
"has_key": true
}
```
After saving a key, all subsequent requests to `GET /providers/fred/series/{series_id}` and `POST /providers/fred/series/{series_id}/data` will automatically use it — you do not need to pass it explicitly in each request.
# Fetch Series Data from External Providers
Source: https://learn.alphacast.io/api/providers/series
Preview or download complete time-series data from FRED, BLS, World Bank, OECD, IMF, BIS, ECB, Eurostat, and central banks across Latin America, Europe, and Asia using the Alphacast provider API.
Once you have found a series ID — through browsing, searching, or the popular series list — you can fetch its data in two steps: a lightweight preview that returns the most recent data points, followed by a full historical fetch. For FRED series, a dedicated shortcut endpoint is also available that bypasses the provider slug workflow.
## Authentication
All endpoints use HTTP Basic Auth. Pass your Alphacast API key as the username with an empty password.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/providers/fred/series/UNRATE
```
For providers that require an upstream API key (such as FRED or INEGI), save your key via `PUT /user-keys/{slug}` first. Alphacast applies it automatically on every series request.
***
## Provider series endpoints
### GET /providers//series/
Returns a preview of the series: the last \~24 data points, the series label, and metadata. The response always includes `"is_preview": true` to signal that the data is truncated.
Use this endpoint to confirm you have the right series before fetching the full history.
**Path parameters**
Provider slug. Examples: `fred`, `bls`, `worldbank`, `bcra`, `banxico`.
The series identifier as recognized by the upstream provider. Format varies by provider — for example, `UNRATE` for FRED, `CUUR0000SA0` for BLS, or `NY.GDP.PCAP.CD` for World Bank.
Some providers — notably SDMX-style sources (UNICEF, ECB, INSEE, BOI, FAOSTAT, Norges Bank) — use hierarchical IDs that contain forward slashes, such as `IMF/IFS/Q.US.NGDP_XDC`. Alphacast accepts these in the URL as-is; you do **not** need to URL-encode the `/` characters.
```bash cURL theme={null}
# Flat ID
curl -u YOUR_API_KEY: \
https://api.alphacast.io/providers/fred/series/UNRATE
# Hierarchical SDMX-style ID with slashes — passed through verbatim
curl -u YOUR_API_KEY: \
https://api.alphacast.io/providers/ecb/series/EXR/D.USD.EUR.SP00.A
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/providers/fred/series/UNRATE",
auth=("YOUR_API_KEY", ""),
)
preview = response.json()
```
```javascript Node.js theme={null}
const response = await fetch(
"https://api.alphacast.io/providers/fred/series/UNRATE",
{ headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") } },
);
const preview = await response.json();
```
**Response fields**
The series identifier that was requested.
Descriptive name of the series as provided by the upstream source. Example: `"Unemployment Rate"`.
Provider-specific metadata about the series. Contents vary by provider but may include frequency, units, seasonal adjustment, source, and notes.
Array of data points, most recent \~24 observations. Each item has:
Observation date in `YYYY-MM-DD` format.
Numeric value for the observation. `null` when the upstream source reports a missing value.
Always `true` for this endpoint. Indicates the data array is truncated to the most recent observations.
Present when the provider requires an upstream API key. Always `true` in that case.
Present when `api_key_required` is `true`. Whether you have a stored key for this provider.
Present when `api_key_required` is `true`. Instructions for obtaining and saving an API key.
**Example response**
```json theme={null}
{
"series_id": "UNRATE",
"label": "Unemployment Rate",
"metadata": {
"frequency": "Monthly",
"units": "Percent",
"seasonal_adjustment": "Seasonally Adjusted",
"last_updated": "2024-04-05"
},
"data": [
{"date": "2024-03-01", "value": 3.8},
{"date": "2024-02-01", "value": 3.9},
{"date": "2024-01-01", "value": 3.7},
{"date": "2023-12-01", "value": 3.7}
],
"is_preview": true
}
```
**Handling api\_key\_required**
When a provider needs an upstream key and you have not stored one, the preview still returns recent data where possible, but includes the key status fields:
```json theme={null}
{
"series_id": "GDP",
"label": "Gross Domestic Product",
"metadata": {"frequency": "Quarterly", "units": "Billions of Dollars"},
"data": [{"date": "2024-01-01", "value": 27360.9}],
"is_preview": true,
"api_key_required": true,
"has_api_key": false,
"api_key_hint": "A FRED API key is required. Get one for free."
}
```
Store your key with `PUT /user-keys/fred` to remove the restriction.
***
### POST /providers//series//data
Returns the full historical time series. This endpoint accepts provider-specific parameters in the request body to control units, frequency, date ranges, and other transformations.
**Path parameters**
Provider slug.
Series identifier.
**Request body**
Provider-specific parameters. The available keys depend on the provider — consult the `parameters` array in `GET /providers/{slug}` for valid options.
Common examples:
| Provider | Parameter key | Example value |
| - | - | - |
| FRED | `units` | `"pc1"` (% change from year ago) |
| FRED | `frequency` | `"q"` (quarterly) |
| BLS | `startyear` | `2010` |
| BLS | `endyear` | `2024` |
| World Bank | `country` | `"BR"` |
| World Bank | `date_range` | `"2000:2024"` |
```bash cURL theme={null}
# Fetch full FRED unemployment data, resampled to annual % change
curl -u YOUR_API_KEY: \
-X POST https://api.alphacast.io/providers/fred/series/UNRATE/data \
-H "Content-Type: application/json" \
-d '{"params": {"units": "pc1", "frequency": "a"}}'
```
```python Python theme={null}
import requests
response = requests.post(
"https://api.alphacast.io/providers/fred/series/UNRATE/data",
auth=("YOUR_API_KEY", ""),
json={"params": {"units": "pc1", "frequency": "a"}},
)
series = response.json()
```
```javascript Node.js theme={null}
const response = await fetch(
"https://api.alphacast.io/providers/fred/series/UNRATE/data",
{
method: "POST",
headers: {
Authorization: "Basic " + btoa("YOUR_API_KEY:"),
"Content-Type": "application/json",
},
body: JSON.stringify({ params: { units: "pc1", frequency: "a" } }),
},
);
const series = await response.json();
```
**Response fields**
The response has the same structure as the preview endpoint, with one difference:
Always `false`. The `data` array contains the complete historical series.
The requested series ID.
Descriptive name of the series.
Provider-specific metadata.
Complete array of all available observations, each with `date` (string, `YYYY-MM-DD`) and `value` (number or null).
**Example response**
```json theme={null}
{
"series_id": "UNRATE",
"label": "Unemployment Rate",
"metadata": {
"frequency": "Monthly",
"units": "Percent",
"seasonal_adjustment": "Seasonally Adjusted",
"last_updated": "2024-04-05"
},
"data": [
{"date": "1948-01-01", "value": 3.4},
{"date": "1948-02-01", "value": 3.8},
"...",
{"date": "2024-03-01", "value": 3.8}
],
"is_preview": false
}
```
***
## Complete workflow example
The following example shows the full sequence: match a provider, search for a series, preview it, then fetch the complete history.
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/providers/match?q=federal+reserve+interest+rates"
```
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/providers/fred/search?q=federal+funds+rate"
```
Note the `id` from the results — for example, `FEDFUNDS`.
```bash theme={null}
curl -u YOUR_API_KEY: \
https://api.alphacast.io/providers/fred/series/FEDFUNDS
```
Check that `label` and `metadata` match what you expect. Confirm `is_preview: true`.
```bash theme={null}
curl -u YOUR_API_KEY: \
-X POST https://api.alphacast.io/providers/fred/series/FEDFUNDS/data \
-H "Content-Type: application/json" \
-d '{"params": {"frequency": "m"}}'
```
The response contains the complete monthly series with `is_preview: false`.
***
## FRED direct endpoints
These endpoints provide a streamlined interface to FRED without the provider slug workflow. They are useful when you already know your FRED symbol.
### GET /fred/search/
Searches FRED for series matching the query string and returns matching symbols and descriptions.
**Path parameters**
Search term to look up in FRED. URL-encode spaces as `%20` or `+`.
```bash theme={null}
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/fred/search/consumer+price+index"
```
**Response**
```json theme={null}
{
"results": [
{
"id": "CPIAUCSL",
"title": "Consumer Price Index for All Urban Consumers: All Items in U.S. City Average",
"frequency": "Monthly",
"units": "Index 1982-1984=100"
}
]
}
```
***
### GET /fred//data
Fetches time-series data for a FRED symbol directly. Returns data as CSV by default; use `$format=json` for a JSON response.
**Path parameters**
FRED series symbol. Examples: `GDP`, `UNRATE`, `CPIAUCSL`, `FEDFUNDS`, `DGS10`.
**Query parameters**
Output format. Accepted values: `json`, `csv`, `xlsx`, `tsv`.
Limit the number of rows returned. Omit to return all available data.
Start date filter in `YYYY-MM-DD` format.
End date filter in `YYYY-MM-DD` format.
```bash theme={null}
# Get CPIAUCSL as JSON, last 5 rows
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/fred/CPIAUCSL/data?$format=json&$top=5"
# Get data between two dates
curl -u YOUR_API_KEY: \
"https://api.alphacast.io/fred/GDP/data?$format=json&start=2020-01-01&end=2023-12-31"
```
***
## Error responses
All endpoints return a JSON error object with an `error` field when a request fails.
| Status | Meaning |
| - | - |
| `400` | The provider does not support the requested operation (e.g., browse on a non-hierarchical provider). |
| `404` | Provider slug or series ID not found. |
| `501` | The connector does not implement this operation. |
| `502` | The upstream provider returned an error. Check the `error` message for details. |
```json theme={null}
{
"error": "Provider does not support hierarchical browse"
}
```
# POST /repositories — Create a Repository
Source: https://learn.alphacast.io/api/repositories/create
Create a new repository to organize datasets. Requires name and privacy. Optionally specify description and team for collaboration.
Repositories are the top-level containers for organizing your datasets on Alphacast. Use this endpoint to create a new repository under your account. You will automatically become the `Owner` of any repository you create.
## Request
```bash theme={null}
POST https://api.alphacast.io/repositories
```
Send a JSON body with the `Content-Type: application/json` header.
## Authentication
This endpoint requires HTTP Basic Auth. Pass your API key as the username and leave the password empty.
## Body parameters
Display name for the new repository.
Visibility setting for the repository. Must be either `"Public"` or `"Private"`.
Optional description of the repository's contents or purpose.
Optional team name to associate this repository with for collaborative access.
## Response
Returns `201 Created` with the newly created repository object.
Unique numeric identifier assigned to the new repository.
Display name of the repository.
Description of the repository, if provided.
Visibility setting. Either `"Public"` or `"Private"`.
The team this repository belongs to, if provided.
Your access level. Always `"Owner"` for repositories you create.
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
-X POST \
-H "Content-Type: application/json" \
-d '{
"name": "Emerging Markets Macro",
"description": "GDP, inflation, and rates for EM economies",
"privacy": "Private",
"team": "research"
}' \
https://api.alphacast.io/repositories
```
```python Python theme={null}
import requests
response = requests.post(
"https://api.alphacast.io/repositories",
auth=("YOUR_API_KEY", ""),
json={
"name": "Emerging Markets Macro",
"description": "GDP, inflation, and rates for EM economies",
"privacy": "Private",
"team": "research",
},
)
repository = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/repositories", {
method: "POST",
headers: {
Authorization: "Basic " + btoa("YOUR_API_KEY:"),
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Emerging Markets Macro",
description: "GDP, inflation, and rates for EM economies",
privacy: "Private",
team: "research",
}),
});
const repository = await response.json();
```
```json 201 theme={null}
{
"id": 101,
"name": "Emerging Markets Macro",
"description": "GDP, inflation, and rates for EM economies",
"privacy": "Private",
"team": "research",
"permission": "Owner"
}
```
# DELETE /repositories/{id} — Delete a Repository
Source: https://learn.alphacast.io/api/repositories/delete
Permanently delete a repository and all its datasets. Requires Owner permission. This action cannot be undone.
This endpoint permanently deletes a repository and every asset it contains. Only the repository owner can delete a repository. The deletion cascades to all datasets stored in the repository, so make sure you have exported or backed up any data you need before calling this endpoint.
Deleting a repository is irreversible. All datasets and associated data inside the repository are permanently removed. There is no way to recover them after deletion.
## Request
```bash theme={null}
DELETE https://api.alphacast.io/repositories/{repository_id}
```
No request body is required.
## Authentication
This endpoint requires HTTP Basic Auth. Pass your API key as the username and leave the password empty.
## Path parameters
The numeric ID of the repository to delete.
## Response
Returns `204 No Content` on success. The response body is empty.
## Errors
| Status | Meaning |
| - | - |
| `403` | You do not have `Owner` permission on this repository. |
| `404` | No repository with the given ID exists, or you do not have access to it. |
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
-X DELETE \
https://api.alphacast.io/repositories/101
```
```python Python theme={null}
import requests
response = requests.delete(
"https://api.alphacast.io/repositories/101",
auth=("YOUR_API_KEY", ""),
)
assert response.status_code == 204
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/repositories/101", {
method: "DELETE",
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
// response.status === 204
```
```text 204 theme={null}
(empty response body)
```
# GET /repositories/{id} — Get a Repository
Source: https://learn.alphacast.io/api/repositories/get
Retrieve a single repository by its numeric ID. Returns the repository object including name, description, privacy, and your permission level.
Use this endpoint to fetch the details of a specific repository by its numeric ID. The response includes your effective permission level for that repository, which determines what operations you can perform on it.
## Request
```bash theme={null}
GET https://api.alphacast.io/repositories/{repository_id}
```
## Authentication
This endpoint requires HTTP Basic Auth. Pass your API key as the username and leave the password empty.
## Path parameters
The numeric ID of the repository to retrieve.
## Response
Returns a single repository object on success.
Unique numeric identifier for the repository.
Display name of the repository.
Optional description of the repository's contents or purpose.
Visibility setting. Either `"Public"` or `"Private"`.
The team this repository belongs to, if applicable.
Your access level for this repository. One of `"Owner"`, `"Admin"`, `"Write"`, `"Clone"`, or `"Read"`. This field is determined by the server based on your API key and cannot be set directly.
## Errors
| Status | Meaning |
| - | - |
| `404` | No repository with the given ID exists, or you do not have access to it. |
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
https://api.alphacast.io/repositories/101
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/repositories/101",
auth=("YOUR_API_KEY", ""),
)
repository = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/repositories/101", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const repository = await response.json();
```
```json 200 theme={null}
{
"id": 101,
"name": "Emerging Markets Macro",
"description": "GDP, inflation, and rates for EM economies",
"privacy": "Private",
"team": "research",
"permission": "Owner"
}
```
```json 404 theme={null}
{
"message": "Repository 101 doesn't exist"
}
```
# GET /repositories/home — Get Home Repository
Source: https://learn.alphacast.io/api/repositories/home
Retrieve the authenticated user's Home repository — the default workspace where pipelines and datasets land when no specific repository is named.
Use this endpoint to resolve your account's Home repository. The Home repository is the default destination when creating pipelines or datasets without specifying a `repositoryId`. The response has the same shape as `GET /repositories/{id}`.
**Workspace-aware alternative — `GET /repositories/default`.** If your account belongs to multiple teams/workspaces, prefer `GET /repositories/default`. It returns the default writable repository for the API key's **currently active workspace**, whereas `/repositories/home` always resolves the single per-user Home repo. The Alphacast MCP server uses `/repositories/default` when it auto-resolves a repository. Both endpoints return the same repository object shape.
## Request
```bash theme={null}
GET https://api.alphacast.io/repositories/home
```
## Authentication
This endpoint requires HTTP Basic Auth. Pass your API key as the username and leave the password empty.
## Response
Returns a single repository object — the same structure as [`GET /repositories/{id}`](/api/repositories/get).
Unique numeric identifier for the Home repository.
Display name of the repository.
Optional description of the repository's contents or purpose.
Visibility setting. Either `"Public"` or `"Private"`.
The team this repository belongs to, if applicable.
Your access level. For your Home repository this is always `"Owner"`.
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
https://api.alphacast.io/repositories/home
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/repositories/home",
auth=("YOUR_API_KEY", ""),
)
home = response.json()
print(home["id"]) # use this ID when creating datasets or pipelines
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/repositories/home", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const home = await response.json();
```
```json 200 theme={null}
{
"id": 42,
"name": "Home",
"description": null,
"privacy": "Private",
"team": null,
"permission": "Owner"
}
```
Store the Home repository ID if you plan to create multiple datasets or pipelines — it saves a round-trip on each creation request.
# GET /repositories — List All Repositories
Source: https://learn.alphacast.io/api/repositories/list
Retrieve all repositories accessible to the authenticated user. Returns an array of repository objects with id, name, privacy, and permission fields.
The list repositories endpoint returns every repository your API key can access, including repositories you own and those shared with you by other team members. The `permission` field in each result tells you your effective access level for that repository.
## Request
```bash theme={null}
GET https://api.alphacast.io/repositories
```
No query parameters or request body are required.
## Authentication
This endpoint requires HTTP Basic Auth. Pass your API key as the username and leave the password empty.
```bash theme={null}
curl -u YOUR_API_KEY: https://api.alphacast.io/repositories
```
## Response
The endpoint returns a JSON array. Each element is a repository object.
Unique numeric identifier for the repository.
Display name of the repository.
Optional description of the repository's contents or purpose.
Visibility setting. Either `"Public"` or `"Private"`.
The team this repository belongs to, if applicable.
Your access level for this repository. One of `"Owner"`, `"Admin"`, `"Write"`, `"Clone"`, or `"Read"`. This field is determined by the server based on your API key and cannot be set directly.
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
https://api.alphacast.io/repositories
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/repositories",
auth=("YOUR_API_KEY", ""),
)
repositories = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/repositories", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const repositories = await response.json();
```
```json 200 theme={null}
[
{
"id": 101,
"name": "Emerging Markets Macro",
"description": "GDP, inflation, and rates for EM economies",
"privacy": "Private",
"team": "research",
"permission": "Owner"
},
{
"id": 204,
"name": "Global Equity Indices",
"description": null,
"privacy": "Public",
"team": null,
"permission": "Read"
}
]
```
# PUT /repositories/{id} — Update a Repository
Source: https://learn.alphacast.io/api/repositories/update
Update an existing repository's name, description, or privacy. Requires Owner permission. Returns the updated repository object on success.
Use this endpoint to rename a repository, update its description, or change its visibility between public and private. Only the repository owner can make these changes — users with `Admin`, `Write`, `Clone`, or `Read` access will receive a `403` error.
## Request
```bash theme={null}
PUT https://api.alphacast.io/repositories/{repository_id}
```
Send a JSON body with the `Content-Type: application/json` header.
## Authentication
This endpoint requires HTTP Basic Auth. Pass your API key as the username and leave the password empty.
You must have `Owner` permission on the repository to update it. Requests from users with any other permission level will be rejected with a `403 Forbidden` response.
## Path parameters
The numeric ID of the repository to update.
## Body parameters
New display name for the repository.
Visibility setting. Must be either `"Public"` or `"Private"`.
Updated description of the repository's contents or purpose.
## Response
Returns `200` with the updated repository object.
Unique numeric identifier for the repository.
Updated display name of the repository.
Updated description, if provided.
Updated visibility setting. Either `"Public"` or `"Private"`.
The team this repository belongs to. Team association cannot be changed via this endpoint.
Your access level. Remains `"Owner"` after an update.
## Errors
| Status | Meaning |
| - | - |
| `403` | You do not have `Owner` permission on this repository. |
| `404` | No repository with the given ID exists, or you do not have access to it. |
## Example
```bash cURL theme={null}
curl -u YOUR_API_KEY: \
-X PUT \
-H "Content-Type: application/json" \
-d '{
"name": "EM Macro — Archived",
"description": "Historical GDP, inflation, and rates for EM economies",
"privacy": "Public"
}' \
https://api.alphacast.io/repositories/101
```
```python Python theme={null}
import requests
response = requests.put(
"https://api.alphacast.io/repositories/101",
auth=("YOUR_API_KEY", ""),
json={
"name": "EM Macro — Archived",
"description": "Historical GDP, inflation, and rates for EM economies",
"privacy": "Public",
},
)
repository = response.json()
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/repositories/101", {
method: "PUT",
headers: {
Authorization: "Basic " + btoa("YOUR_API_KEY:"),
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "EM Macro — Archived",
description: "Historical GDP, inflation, and rates for EM economies",
privacy: "Public",
}),
});
const repository = await response.json();
```
```json 200 theme={null}
{
"id": 101,
"name": "EM Macro — Archived",
"description": "Historical GDP, inflation, and rates for EM economies",
"privacy": "Public",
"team": "research",
"permission": "Owner"
}
```
# Authenticate with the Alphacast API
Source: https://learn.alphacast.io/authentication
Learn how to authenticate Alphacast API requests using your API key via HTTP Basic Auth or as a query parameter, with examples in curl and Python.
Every request to the Alphacast API must include an API key. You can obtain your key from your account settings at [alphacast.io](https://alphacast.io) — navigate to **Account Settings → API Key** to generate or view your key. Alphacast supports two ways to pass your API key: as an HTTP Basic Auth credential, or as a URL query parameter.
Your API key grants full access to your Alphacast account. Do not share it publicly, commit it to version control, or expose it in client-side code.
## Authentication methods
Alphacast supports two ways to pass your API key. HTTP Basic Auth is the recommended option for most integrations.
Pass your API key as the **username** with an **empty password**. Credentials travel in the `Authorization` header, never in the URL.
```bash curl theme={null}
curl https://api.alphacast.io/datasets \
-u YOUR_API_KEY:
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/datasets",
auth=("YOUR_API_KEY", "")
)
print(response.json())
```
```javascript Node.js theme={null}
const response = await fetch("https://api.alphacast.io/datasets", {
headers: { Authorization: "Basic " + btoa("YOUR_API_KEY:") },
});
const datasets = await response.json();
```
The colon after the API key (in `curl`) and the empty string as the second element of the `auth` tuple (in Python) indicate an empty password. Most HTTP clients accept this convention without additional configuration.
Append `?apiKey=YOUR_API_KEY` to any request URL. Convenient for quick tests in a browser or when your HTTP client does not easily support Basic Auth headers.
```bash curl theme={null}
curl "https://api.alphacast.io/datasets?apiKey=YOUR_API_KEY"
```
```python Python theme={null}
import requests
response = requests.get(
"https://api.alphacast.io/datasets",
params={"apiKey": "YOUR_API_KEY"}
)
print(response.json())
```
```javascript Node.js theme={null}
const url = new URL("https://api.alphacast.io/datasets");
url.searchParams.set("apiKey", "YOUR_API_KEY");
const response = await fetch(url);
const datasets = await response.json();
```
When using the query parameter method, make sure your API key is not captured in server logs or browser history, especially in production environments. HTTP Basic Auth is generally more secure because credentials travel in headers, not in the URL.
## Authentication errors
If a request is missing credentials or the API key is invalid, the API responds with HTTP `401 Unauthorized`:
```json theme={null}
{"error": "Unauthorized"}
```
Common causes:
* The API key was not included in the request
* The API key has been revoked or regenerated
* The key was passed as the password instead of the username in Basic Auth
## Keeping your API key safe
Store your API key in an environment variable rather than hardcoding it. For example, set `ALPHACAST_API_KEY` in your environment and read it at runtime:
```python theme={null}
import os
import requests
api_key = os.environ["ALPHACAST_API_KEY"]
response = requests.get(
"https://api.alphacast.io/datasets",
auth=(api_key, "")
)
```
If you believe your API key has been compromised, regenerate it immediately from your account settings at [alphacast.io](https://alphacast.io). Regenerating a key immediately invalidates the previous one.
# Data Providers: Built-In Sources for Market Data
Source: https://learn.alphacast.io/concepts/data-providers
Alphacast ships built-in connectors for 30+ external sources — FRED, BLS, World Bank, OECD, IMF, BIS, ECB, Eurostat, Banxico, BCRA, and many more. Browse, search, and pull series through a single unified REST API.
Alphacast ships with built-in connectors for a curated set of 30+ data providers, covering central banks, national statistics offices, market data sources, and international organizations from around the world. You can browse a provider's catalog hierarchically, search it by keyword, or fetch a specific series by ID — all through the same REST API.
The authoritative list of providers — with their popular series, parameters, and key requirements — lives at **alphacast.io/explore/apis**.
## Available providers
| Slug | Provider | Category |
| - | - | - |
| `a3` | A3 Mercados (Matba/Rofex) | Markets |
| `abs` | Australian Bureau of Statistics | Statistics |
| `banrep` | Banco de la República (Colombia) | Central bank |
| `banxico` | Banxico — Banco de México | Central bank |
| `bcch` | Banco Central de Chile (BDE) | Central bank |
| `bcb-opendata` | BCB — Banco Central do Brasil | Markets |
| `bcra` | BCRA — Banco Central de la República Argentina | Central bank |
| `bcrp` | BCRP — Banco Central de Reserva del Perú | Central bank |
| `bea` | U.S. Bureau of Economic Analysis | U.S. federal |
| `bis` | BIS — Bank for International Settlements | Markets |
| `bls` | U.S. Bureau of Labor Statistics | Statistics |
| `boc` | Bank of Canada (Valet) | Central bank |
| `boe` | Bank of England | Central bank |
| `boi` | Bank of Israel | Central bank |
| `cepalstat` | CEPALSTAT (ECLAC) | Curated |
| `coingecko` | CoinGecko | Markets |
| `ecb` | European Central Bank | Central bank |
| `eia` | U.S. Energy Information Administration | U.S. federal |
| `eurostat` | Eurostat | Statistics |
| `faostat` | FAO FAOSTAT | Statistics |
| `fred` | Federal Reserve Economic Data (St. Louis Fed) | U.S. federal |
| `hkma` | Hong Kong Monetary Authority | Central bank |
| `ilo` | International Labour Organization | International |
| `imf` | International Monetary Fund | International |
| `inegi` | INEGI (Mexico) | Statistics |
| `insee` | INSEE (France) | Statistics |
| `mae` | MAE — Mercado Abierto Electrónico (Argentina) | Markets |
| `norges` | Norges Bank | Central bank |
| `oecd` | OECD Statistics | Statistics |
| `opendosm` | OpenDOSM (Malaysia) | Statistics |
| `owid` | Our World in Data | Curated |
| `scb` | Statistics Sweden | Statistics |
| `sidra` | IBGE SIDRA (Brazil) | Statistics |
| `ssb` | Statistics Norway | Statistics |
| `taiwan-cbc` | Central Bank of Taiwan (CBC DataAPI) | Central bank |
| `unicef` | UNICEF Data Warehouse | International |
| `unsd` | UN Statistics Division | Statistics |
| `worldbank` | World Bank Open Data | International |
Not all providers support all three capability modes. Check the `capabilities` array in `GET /providers/{slug}` to know which modes are available for a given provider.
## Provider capabilities
* **`hierarchical`** — Browse the provider's catalog as a tree of categories. Use `GET /providers/{slug}/browse` to navigate.
* **`search`** — Search across the provider's catalog by keyword. Use `GET /providers/{slug}/search?q=your+query`.
* **`direct`** — Fetch a specific series if you already know its ID. Use `GET /providers/{slug}/series/{seriesId}`.
## API endpoints
The base URL for all provider operations is `https://api.alphacast.io`.
| Method | Endpoint | Description |
| - | - | - |
| `GET` | `/providers` | List all available providers |
| `GET` | `/providers/{slug}` | Get a single provider's details and capabilities |
| `GET` | `/providers/{slug}/browse` | Browse the provider's catalog hierarchically |
| `GET` | `/providers/{slug}/search` | Search a provider's catalog |
| `GET` | `/providers/{slug}/series/{seriesId}` | Preview the last 24 data points for a series |
| `POST` | `/providers/{slug}/series/{seriesId}/data` | Fetch the full series data |
| `PUT` | `/user-keys/{slug}` | Store your personal API key for a provider |
## Listing all providers
```bash theme={null}
curl https://api.alphacast.io/providers \
-u YOUR_API_KEY:
```
```json theme={null}
[
{
"slug": "fred",
"name": "FRED Economic Data",
"provider": "Federal Reserve Bank of St. Louis",
"description": "Hundreds of thousands of economic time series from dozens of national, international, public, and private sources.",
"capabilities": ["search", "hierarchical", "direct"],
"license": "Public Domain (mostly)"
}
]
```
## Browsing hierarchically
For providers with the `hierarchical` capability, you can navigate the catalog tree using the `path` parameter. Start at the root and drill down by appending path segments.
```bash theme={null}
# Browse the root of the FRED catalog
curl "https://api.alphacast.io/providers/fred/browse" \
-u YOUR_API_KEY:
# Browse a subcategory
curl "https://api.alphacast.io/providers/fred/browse?path=National%20Accounts" \
-u YOUR_API_KEY:
```
## Searching a provider
```bash theme={null}
curl "https://api.alphacast.io/providers/fred/search?q=unemployment+rate" \
-u YOUR_API_KEY:
```
## Fetching a FRED series
Once you know a series ID, fetch a preview (last 24 data points) with a GET request, or the full dataset with a POST.
```bash Preview (last 24 points) theme={null}
curl "https://api.alphacast.io/providers/fred/series/UNRATE" \
-u YOUR_API_KEY:
```
```bash Full series theme={null}
curl -X POST "https://api.alphacast.io/providers/fred/series/UNRATE/data" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{"params": {}}'
```
```json theme={null}
{
"series_id": "UNRATE",
"label": "Unemployment Rate",
"metadata": {
"frequency": "Monthly",
"units": "Percent",
"seasonal_adjustment": "Seasonally Adjusted"
},
"data": [
{ "date": "2024-10-01", "value": 4.1 },
{ "date": "2024-11-01", "value": 4.2 }
],
"is_preview": false
}
```
## Storing a provider API key
Some providers — including FRED and BLS — require their own API key to access higher rate limits or restricted data. You can store your key in Alphacast so it is used automatically whenever you fetch from that provider.
```bash theme={null}
curl -X PUT https://api.alphacast.io/user-keys/fred \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{"api_key": "YOUR_FRED_API_KEY"}'
```
```json theme={null}
{ "slug": "fred", "has_key": true }
```
To remove a stored key, send `null` or an empty string as the `api_key` value.
To get a free FRED API key, register at [https://fred.stlouisfed.org/docs/api/api\_key.html](https://fred.stlouisfed.org/docs/api/api_key.html). Without a key, FRED requests may be rate-limited.
# Datasets: Storing and Accessing Time-Series Data
Source: https://learn.alphacast.io/concepts/datasets
Datasets hold tabular and time-series data inside Alphacast repositories. Upload CSV files, query with OData filters, and download in CSV, JSON, XLSX, or TSV.
A dataset is where your actual data lives in Alphacast. Every dataset belongs to a repository and holds a table of rows and columns — typically a time series with one date column and one or more value columns. You can upload data into a dataset, query it with OData-style filters, and download results as CSV, JSON, XLSX, or TSV.
## Dataset fields
When you create a dataset, the following fields are available:
| Field | Required | Description |
| - | - | - |
| `name` | Yes | Display name for the dataset |
| `repositoryId` | Yes | ID of the repository that owns this dataset |
| `description` | No | Human-readable description |
| `sourceUrl` | No | URL of the original data source |
| `sourceName` | No | Name of the original data source |
## Column types
Each column in a dataset has a `dataType` and an `isEntity` flag:
* **`Date`** — A date or datetime column. Entity columns of type `Date` are used as the time axis.
* **`String`** — A text column. Entity string columns act as dimension labels (e.g., country, sector).
* **`Decimal`** — A numeric value column. These are the measurements in your time series.
Columns where `isEntity` is `true` are dimension columns (they identify a row). Columns where `isEntity` is `false` are value columns (they hold the measurements).
## API endpoints
The base URL for all dataset operations is `https://api.alphacast.io`.
| Method | Endpoint | Description |
| - | - | - |
| `GET` | `/datasets` | List all datasets you have access to |
| `POST` | `/datasets` | Create a new dataset |
| `GET` | `/datasets/{id}` | Get a dataset's metadata |
| `PUT` | `/datasets/{id}` | Rename a dataset or move it to another repository |
| `DELETE` | `/datasets/{id}` | Delete a dataset |
| `GET` | `/datasets/{id}/data` | Download dataset data |
| `PUT` | `/datasets/{id}/data` | Upload data into a dataset |
| `GET` | `/datasets/{id}/date-stats` | Get the date range and inferred frequency |
## Creating a dataset
```bash theme={null}
curl -X POST https://api.alphacast.io/datasets \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"name": "US GDP Quarterly",
"repositoryId": 1042,
"description": "Quarterly US GDP in billions of chained 2017 dollars",
"sourceUrl": "https://fred.stlouisfed.org/series/GDPC1",
"sourceName": "FRED"
}'
```
## Downloading data
Use `GET /datasets/{id}/data` to download a dataset's contents. You can shape the response with OData query parameters.
### Query parameters
| Parameter | Description |
| - | - |
| `$select` | Comma-separated list of column names or IDs to include |
| `$filter` | OData filter expression (e.g., `Date ge '2020-01-01'`) |
| `$top` | Maximum number of rows to return |
| `$last` | Return only rows from the last N date periods |
| `$format` | Output format: `csv` (default), `json`, `xlsx`, or `tsv` |
```bash Download as CSV theme={null}
curl "https://api.alphacast.io/datasets/5801/data" \
-u YOUR_API_KEY:
```
```bash Filter by date range theme={null}
curl "https://api.alphacast.io/datasets/5801/data?\$filter=Date%20ge%20'2020-01-01'&\$format=json" \
-u YOUR_API_KEY:
```
```bash Last 8 periods theme={null}
curl "https://api.alphacast.io/datasets/5801/data?\$last=8" \
-u YOUR_API_KEY:
```
For large datasets with no filters, the API returns a pre-signed download URL instead of streaming the file directly. Follow the redirect to download the file.
## Date stats
Use the date-stats endpoint to inspect a dataset's temporal coverage before downloading it.
```bash theme={null}
curl "https://api.alphacast.io/datasets/5801/date-stats" \
-u YOUR_API_KEY:
```
```json theme={null}
{
"inferedFreq": "Q",
"minDate": "1947-01-01",
"maxDate": "2024-10-01"
}
```
The `inferedFreq` field returns the detected cadence of the data (e.g., `D` for daily, `M` for monthly, `Q` for quarterly, `A` for annual).
If the frequency cannot be determined from cached metadata, the API will scan the dataset's date column to infer it on the fly. This may take a moment for large datasets.
# Repositories: Organizing Your Data in Alphacast
Source: https://learn.alphacast.io/concepts/repositories
Repositories are the top-level containers in Alphacast. Every dataset you create belongs to a repository, and you control who can access it.
A repository is the top-level container for all your work in Alphacast. Before you can create a dataset, you need a repository to hold it. Think of a repository like a project folder: it groups related datasets together, carries a privacy setting, and lets you share access with teammates at different permission levels.
## Privacy settings
When you create or update a repository, you choose one of two privacy modes:
| Setting | Who can see it |
| - | - |
| `Private` | Only you and users you explicitly grant access to |
| `Public` | Visible to anyone with an Alphacast account |
## Permission levels
Access to a repository is controlled through a tiered permission model. Each level inherits the capabilities of the levels below it.
| Permission | Can read | Can clone | Can write | Admin actions | Delete |
| - | - | - | - | - | - |
| `Read` | ✓ | | | | |
| `Clone` | ✓ | ✓ | | | |
| `Write` | ✓ | ✓ | ✓ | | |
| `Admin` | ✓ | ✓ | ✓ | ✓ | |
| `Owner` | ✓ | ✓ | ✓ | ✓ | ✓ |
Only the `Owner` of a repository can delete it.
## API endpoints
The base URL for all repository operations is `https://api.alphacast.io`.
| Method | Endpoint | Description |
| - | - | - |
| `GET` | `/repositories` | List all repositories you have access to |
| `POST` | `/repositories` | Create a new repository |
| `GET` | `/repositories/{id}` | Get a single repository by ID |
| `PUT` | `/repositories/{id}` | Update a repository's name, description, or privacy |
| `DELETE` | `/repositories/{id}` | Delete a repository and all its assets (Owner only) |
## Examples
### List your repositories
```bash theme={null}
curl https://api.alphacast.io/repositories \
-u YOUR_API_KEY:
```
### Create a repository
The `name` and `privacy` fields are required. You can optionally assign the repository to a `team`.
```bash cURL theme={null}
curl -X POST https://api.alphacast.io/repositories \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"name": "Emerging Markets Data",
"description": "Macro indicators for EM economies",
"privacy": "Private",
"team": "research"
}'
```
```json Response theme={null}
{
"id": 1042,
"name": "Emerging Markets Data",
"description": "Macro indicators for EM economies",
"privacy": "Private",
"permission": "Owner"
}
```
Deleting a repository removes all datasets inside it. This action cannot be undone.
## Request body fields
| Field | Type | Required | Description |
| - | - | - | - |
| `name` | string | Yes | Display name for the repository |
| `description` | string | No | Optional free-text description |
| `privacy` | string | Yes | `"Public"` or `"Private"` |
| `team` | string | No | Team slug to associate the repository with |
# Alphacast: Financial Data Analytics for Everyone
Source: https://learn.alphacast.io/introduction
Alphacast is a financial data analytics platform for managing datasets and connecting to global data providers via API.
Alphacast is a financial data analytics platform that lets you collect and distribute economic and financial data at scale. Whether you are pulling macro indicators from the Federal Reserve or uploading your own proprietary datasets, Alphacast gives you a single API to manage the full data lifecycle — from ingestion through to download.
## What you can do with Alphacast
With the Alphacast API you can:
* **Manage datasets** — create, update, and delete datasets within organized repositories
* **Connect to 30+ external data providers** — including FRED, BLS, World Bank, OECD, IMF, BIS, ECB, Eurostat, and central banks across Latin America, Europe, and Asia. Browse the live catalog at [alphacast.io/explore/apis](https://www.alphacast.io/explore/apis).
* **Download data in multiple formats** — export any dataset as CSV, JSON, XLSX, or TSV
All API requests are authenticated with an API key that you generate from your account settings at [alphacast.io](https://alphacast.io). Requests can be authenticated via HTTP Basic Auth or a query parameter — both approaches are covered in the authentication guide.
The base URL for all API requests is `https://api.alphacast.io`.
## Get started
Create a repository, upload a dataset, and download data in minutes.
Learn how to authenticate every request with your API key.
Understand how repositories organize your datasets and control access.
Explore every endpoint, parameter, and response schema.
Manage repositories and datasets directly from Python — no HTTP required.
# MCP Authentication
Source: https://learn.alphacast.io/mcp/authentication
How the Alphacast MCP server authenticates: OAuth for the hosted server, or the ALPHACAST_API_KEY environment variable for the local npm package.
How you authenticate depends on which transport you use:
* **Hosted (remote) server** — OAuth. You sign in through your browser; there is no key to copy or store.
* **Local (npm) server** — an API key in the `ALPHACAST_API_KEY` environment variable.
Both authenticate as the same Alphacast account and inherit the same repository permissions.
## OAuth (hosted server)
The hosted server at `https://mcp.alphacast.io/mcp` is an OAuth 2.0 protected resource. The first time your client connects, it runs a standard authorization-code flow with PKCE:
1. Your client opens a browser to the Alphacast authorization server at `https://auth.alphacast.io/`.
2. You sign in with your Alphacast account (or approve the request if already signed in) and consent to the requested scopes.
3. The client receives a token and uses it as a `Bearer` token on every request. Most clients refresh it automatically, so you only sign in once.
The server requests these scopes:
| Scope | Grants |
| - | - |
| `openid`, `profile`, `email` | Identifies your Alphacast account. |
| `mcp:read` | The 28 read-only tools (search, download, providers, tickers, grapher). |
| `mcp:write` | The 4 pipeline write tools (`create_pipeline`, `add_pipeline_step`, `edit_pipeline_step`, `delete_pipeline_step`). |
No API key is involved in this path — nothing to paste into a config file and nothing to rotate. To revoke access, sign out / remove the connector in your client, or revoke the session from your Alphacast account.
Most clients that support remote MCP servers (Claude Code, Claude Desktop, Cursor, VS Code) handle this OAuth flow for you. Clients that only support local stdio servers can reach the hosted server through the `mcp-remote` bridge, which performs the same browser login — see [Other clients](/mcp/configuration/other-clients).
## API key (local server)
The local npm package reuses the same API key as the REST API. There is no OAuth flow on this path.
### Environment variable
The server reads your API key from the `ALPHACAST_API_KEY` environment variable at startup. You set this once in your client's MCP configuration:
```json theme={null}
{
"env": {
"ALPHACAST_API_KEY": "YOUR_ALPHACAST_API_KEY"
}
}
```
The server uses this key internally when calling the Alphacast REST API on your behalf.
The key is **the same raw API key** you use for the REST API (where it goes as the HTTP Basic Auth username). Both authenticate as the same Alphacast account.
## Permissions
The MCP server inherits whatever permissions the API key has on the underlying account:
| Account permission | What MCP can do |
| - | - |
| Read on a repository | List, search, and download datasets in that repository. |
| Write on a repository | All Read operations. (Dataset and repository creation are intentionally not exposed via MCP.) |
| Owner / Admin on a repository | Same as Write. Repository and dataset deletion are intentionally not exposed. |
If a tool call returns `403 Forbidden`, the API key does not have the required permission on the target repository. Generate a new key under an account with the right access, or have the repository owner grant you write access.
## Where to manage your key
* View, create, and revoke keys: [alphacast.io/settings](https://www.alphacast.io/settings).
* Reference for the same key in the REST API: [Authentication](/authentication).
* Rotate immediately if a key was exposed; rotation invalidates the previous value.
## What the server does *not* see
The server does not store the conversation history of your MCP client, the prompts you wrote, or the responses the model generated. Tool inputs and outputs travel only between your client, the Alphacast MCP server, and the Alphacast REST API. On the local path the server runs entirely on your machine and only ever sees the API key from the environment variable; on the hosted path it sees only the OAuth token your client presents.
# Connect Claude Code
Source: https://learn.alphacast.io/mcp/configuration/claude-code
Add the Alphacast MCP server to Claude Code — the hosted server over OAuth, or the local npm package via npx.
Claude Code supports both transports. Use the **hosted** server (no install, OAuth login) or the **local** npm package (spawned via `npx`).
## Hosted (remote, OAuth)
Add the remote server with the HTTP transport — no Node.js or API key required:
```bash theme={null}
claude mcp add --transport http alphacast https://mcp.alphacast.io/mcp
```
The first time you use it, authorize the connection: run `/mcp`, select `alphacast`, and choose **Authenticate**. Claude Code opens your browser to sign in with your Alphacast account and stores the token for you.
To remove it later:
```bash theme={null}
claude mcp remove alphacast
```
Add `--scope project` to share a checked-in `.mcp.json` with collaborators (each person still authenticates with their own Alphacast account — no secret is committed):
```json .mcp.json theme={null}
{
"mcpServers": {
"alphacast": {
"type": "http",
"url": "https://mcp.alphacast.io/mcp"
}
}
}
```
## Local (npm package)
Claude Code launches the Alphacast MCP server as a local subprocess via `npx`. You can add it with a single CLI command, or by editing the project-level `.mcp.json` file.
### CLI (recommended)
Run this from any directory inside your project. The server is added at the user scope by default — pass `--scope project` to share it with collaborators via a checked-in `.mcp.json`.
```bash theme={null}
claude mcp add alphacast -e ALPHACAST_API_KEY=YOUR_API_KEY -- npx -y @alphacast/mcp
```
To remove it later:
```bash theme={null}
claude mcp remove alphacast
```
To list configured servers and their status:
```bash theme={null}
claude mcp list
```
### `.mcp.json` (project-scoped, checked into the repo)
If you want the server available to anyone who clones the project, create or edit `.mcp.json` at the repo root:
```json .mcp.json theme={null}
{
"mcpServers": {
"alphacast": {
"command": "npx",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
Do **not** commit a real API key to a project-scoped `.mcp.json`. Use an environment variable reference (e.g. `"ALPHACAST_API_KEY": "${ALPHACAST_API_KEY}"`) and document the variable in your project README.
## Verify
Open a new Claude Code session and run:
```
/mcp
```
The `alphacast` server should appear with 32 tools and a green `connected` status. If it shows red, run `claude mcp list` to inspect the configured command and environment.
Try a prompt that hits a read-only tool to confirm the connection end-to-end:
> "Use the alphacast MCP to list my repositories."
# Connect Claude Desktop
Source: https://learn.alphacast.io/mcp/configuration/claude-desktop
Connect Claude Desktop to the Alphacast MCP server — the hosted server as a custom connector (OAuth), or the local npm package via npx.
Claude Desktop can reach the Alphacast MCP server two ways: as a **hosted connector** (no install, sign in with OAuth) or as a **local process** launched via `npx` and defined in `claude_desktop_config.json`.
## Hosted (remote, OAuth) — recommended, no terminal
This is the simplest path: no JSON file to edit, no Node.js, no API key.
In Claude, open **Customize** (left sidebar) → **Connectors**. (Depending on your Claude version this may also live under your profile → **Settings → Connectors**.)
Click the **+** button → **Add custom connector**, and fill the two fields:
| Field | Value |
| - | - |
| Name | `Alphacast` |
| URL | `https://mcp.alphacast.io/mcp` |
The **OAuth Client ID / Secret** fields under **Advanced settings** are optional — leave them empty. Click **Add**.
The Alphacast connector opens showing *"You are not connected to Alphacast yet"* → click **Connect**. Claude opens your browser to sign in with your Alphacast account and authorize the `mcp:read` / `mcp:write` scopes. Once authorized, the connector shows the 32 tools.
Open a new chat, confirm the **Alphacast** tools appear in the tools menu, and send *"List my Alphacast repositories."* — you should see a `list_repositories` tool call.
**Usage notes for the hosted connector.** This version sometimes disconnects on its own, and it also disconnects if you log out of the Alphacast platform. To reconnect, go back to **Connectors** and click **Connect** again. You can check the state on that same Connectors screen: if Alphacast is really connected a check mark (✓) shows in the **Status** column; otherwise you'll see a **Connect** button.
Custom connectors require a Claude plan that supports them. If you don't see **Add custom connector**, use the local path below, or bridge the hosted server through `mcp-remote`: set `"command": "npx"`, `"args": ["-y", "mcp-remote", "https://mcp.alphacast.io/mcp"]` (no `env` block) in `claude_desktop_config.json` — it opens the same browser login.
## Local (npm package)
Claude Desktop launches the server as a local process defined in `claude_desktop_config.json`. The server runs via `npx` and communicates over stdio.
`npx` ships with Node.js. If `npx` is not found, install Node 18 or later from [nodejs.org](https://nodejs.org/). On a corporate machine without admin rights, see [Install Node.js without admin rights](/mcp/troubleshooting#no-admin-rights-to-install-nodejs-windows).
Sign in to Alphacast and open [Settings](https://www.alphacast.io/settings). Copy your API key. If you belong to multiple teams, make sure your active team subscription is selected first — the key inherits that team's permissions.
The most reliable way — it works no matter where Claude Desktop is installed:
1. In Claude Desktop, open your profile → **Settings** → **Developer**.
2. Click **Edit Config**. This opens the folder containing `claude_desktop_config.json`.
3. Open `claude_desktop_config.json` in any text editor.
For reference, the standard locations are:
| OS | Path |
| - | - |
| macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
| Linux | `~/.config/Claude/claude_desktop_config.json` |
Enterprise deployments of Claude Desktop may use a different directory (for example `%LOCALAPPDATA%\Claude-3p\` on Windows). If the standard path doesn't exist on your machine, use the **Edit Config** button above, or search for `claude_desktop_config.json` with Windows Search.
**If the file is empty or doesn't exist**, paste this entire block (replace `YOUR_API_KEY` with your key):
```json claude_desktop_config.json theme={null}
{
"mcpServers": {
"alphacast": {
"command": "npx",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
**If the file already has content** (other MCP servers or settings), add the `alphacast` entry inside the existing `mcpServers` object — don't paste the whole block again:
```json claude_desktop_config.json theme={null}
{
"mcpServers": {
"some-other-server": {
"command": "..."
},
"alphacast": {
"command": "npx",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
The most common failure at this step is invalid JSON: a missing comma between server entries, an extra trailing comma, or unbalanced braces. If Claude Desktop silently ignores your server after a restart, the JSON is almost certainly malformed. Quick fix: paste the full file content into a Claude chat and ask it to find and fix the JSON error.
When saving on Windows, if your editor offers **Save As**, set "Save as type" to **All Files** so the file isn't saved as `claude_desktop_config.json.txt`.
Quit Claude Desktop completely — right-click the menu bar / system tray icon and choose **Quit**. Closing the window is not enough; the app keeps running in the background and won't reload the config. Then relaunch it.
The "running" badge next to the server in **Settings → Developer** is **not** proof that the server works. It can show "running" even when the server failed to start or authenticate. Always verify in the chat itself.
1. Open a **new chat** and click the tools menu (the slider icon). You should see the **alphacast** server listed with its 32 tools enabled.
2. Send a test prompt:
> "List my Alphacast repositories."
3. Confirm that Claude **calls a tool** — you'll see a `list_repositories` tool-call block in the response. If Claude answers from general knowledge with no tool call (and no tools icon appears), the server is not actually connected, even if the Developer tab says "running".
If verification fails, open **Settings → Developer → Open MCP Logs** — the logs are the only reliable way to diagnose a failed server. What to look for:
| Log message | Cause | Fix |
| - | - | - |
| `npx` not found / spawn error | Node.js missing or not on PATH | [Install Node.js](/mcp/troubleshooting#no-admin-rights-to-install-nodejs-windows) or use the [full path to `npx.cmd`](/mcp/troubleshooting#client-says-mcp-server-failed-to-start-or-shows-a-red-status) |
| `401 Unauthorized` | Invalid or missing API key | [Authentication errors](/mcp/troubleshooting#401-unauthorized-on-every-tool-call) |
| JSON parse error / server missing entirely | Malformed config file | [Fix the config JSON](/mcp/troubleshooting#the-config-json-is-invalid-server-disappears-or-never-loads) |
## Next steps
Setup, authentication, and connection fixes — including enterprise Windows environments.
Full prompts that combine search, download, and provider tools.
# Connect Codex
Source: https://learn.alphacast.io/mcp/configuration/codex
Add the Alphacast MCP server to OpenAI Codex — the hosted server over OAuth, or the local npm package via npx.
Codex supports both transports. Use the **hosted** server (no install, OAuth login) or the **local** npm package (spawned via `npx`). The CLI and IDE extension share the same configuration.
## Hosted (remote, OAuth)
Codex's native remote-MCP support over streamable HTTP is still rolling out and varies by version. The most reliable way to reach the hosted server today is the `mcp-remote` bridge — a small stdio-to-HTTP adapter that performs the browser OAuth login for you:
```toml config.toml theme={null}
[mcp_servers.alphacast]
command = "npx"
args = ["-y", "mcp-remote", "https://mcp.alphacast.io/mcp"]
```
The first time Codex starts the server, `mcp-remote` opens your browser to sign in with your Alphacast account and caches the token under `~/.mcp-auth`. No API key is needed.
If your Codex version supports native streamable-HTTP servers, you can instead point it directly at `url = "https://mcp.alphacast.io/mcp"` (enabling `experimental_use_rmcp_client = true` if your version requires it) and authenticate with `codex mcp login alphacast`. If that fails, fall back to the `mcp-remote` bridge above.
## Local (npm package)
Codex launches the Alphacast MCP server as a local subprocess via `npx`. You can add it with a single CLI command, or by editing `config.toml`.
### CLI (recommended)
```bash theme={null}
codex mcp add alphacast --env ALPHACAST_API_KEY=YOUR_API_KEY -- npx -y @alphacast/mcp
```
To check configured servers:
```bash theme={null}
codex mcp list
```
### `config.toml` (manual)
Edit `~/.codex/config.toml` for user scope, or create `.codex/config.toml` at your project root for project scope.
```toml config.toml theme={null}
[mcp_servers.alphacast]
command = "npx"
args = ["-y", "@alphacast/mcp"]
[mcp_servers.alphacast.env]
ALPHACAST_API_KEY = "YOUR_API_KEY"
```
Do not commit a real API key to a project-scoped `config.toml`. Use environment variable forwarding instead:
```toml theme={null}
[mcp_servers.alphacast]
command = "npx"
args = ["-y", "@alphacast/mcp"]
env_vars = ["ALPHACAST_API_KEY"]
```
This reads `ALPHACAST_API_KEY` from your local environment at runtime.
## Verify
In a Codex session, type `/mcp` to see active servers. The `alphacast` server should appear with its 32 tools. Try a prompt:
> "Use the alphacast tools to list my repositories."
If the server fails to start, ensure Node.js 18+ is installed and `npx` is on your system PATH.
# Connect Cursor
Source: https://learn.alphacast.io/mcp/configuration/cursor
Configure Cursor to use the Alphacast MCP server — the hosted server over OAuth, or the local npm package.
You configure the server in `.cursor/mcp.json` either at the project root (shared with collaborators) or in your user directory (private to you). Cursor supports both the hosted remote server and the local npm package.
## Configuration file location
| Scope | Path |
| - | - |
| Project | `/.cursor/mcp.json` |
| User | `~/.cursor/mcp.json` |
Project-scoped configuration takes precedence when both exist. Use the user-scoped path when you want the server available across every project on your machine.
## Hosted (remote, OAuth)
Point Cursor at the remote URL — no `npx`, no Node.js, no API key:
```json .cursor/mcp.json theme={null}
{
"mcpServers": {
"alphacast": {
"url": "https://mcp.alphacast.io/mcp"
}
}
}
```
After saving, open **Settings → MCP**. Cursor shows the `alphacast` server with a **Login** / **Authenticate** button — click it to sign in with your Alphacast account in the browser. Because no secret is stored, this config is safe to commit to a project-scoped file; each collaborator authenticates with their own account.
## Local (npm package)
```json .cursor/mcp.json theme={null}
{
"mcpServers": {
"alphacast": {
"command": "npx",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
Do not commit a real API key to a project-scoped file. Either rely on the user-scoped path, or wire up a secrets manager and document the setup in your project README.
## Apply the change
1. Save `.cursor/mcp.json`.
2. Open Cursor's settings → **Features → MCP** and click **Refresh**, or reload the window (`Cmd/Ctrl + Shift + P` → **Developer: Reload Window**).
## Verify
Open the MCP panel in Cursor's settings. The `alphacast` server should appear with a green dot and 32 tools listed. In the chat, try:
> "Use the alphacast tools to list my repositories."
If the server fails to connect, the most common causes are an invalid `ALPHACAST_API_KEY` or Node.js 18+ not being on the system PATH.
# Other MCP Clients
Source: https://learn.alphacast.io/mcp/configuration/other-clients
Connect VS Code, Zed, Windsurf, and any custom MCP client to the Alphacast MCP server — hosted (OAuth) or local (npx).
Every client can reach Alphacast either way. The **hosted** server lives at `https://mcp.alphacast.io/mcp` and authenticates with OAuth; the **local** npm package runs as a subprocess via `npx` and authenticates with `ALPHACAST_API_KEY`. Both expose the same 32 tools.
## Hosted (remote, OAuth)
Clients with native remote-MCP support take the URL directly (see VS Code and Windsurf below). For any client that only speaks local stdio — including Zed and most custom setups — use the **`mcp-remote`** bridge. It runs locally, connects to the hosted URL, and handles the browser OAuth login (caching the token under `~/.mcp-auth`):
| Field | Value |
| - | - |
| Command | `npx` |
| Args | `["-y", "mcp-remote", "https://mcp.alphacast.io/mcp"]` |
| Environment | *(none — auth happens in the browser)* |
So anywhere this page shows a local config below, you can swap in the hosted server by replacing `"@alphacast/mcp"` with `"mcp-remote", "https://mcp.alphacast.io/mcp"` and dropping the `env` block. The native-URL form is shown per client where supported.
## Local (npm package)
The exact configuration format varies by client, but the local values are always the same:
| Field | Value |
| - | - |
| Command | `npx` |
| Args | `["-y", "@alphacast/mcp"]` |
| Environment | `ALPHACAST_API_KEY=YOUR_API_KEY` |
## VS Code (GitHub Copilot Chat / Continue)
VS Code MCP support lives in `.vscode/mcp.json` for project scope or in user settings for global scope.
```json .vscode/mcp.json theme={null}
{
"servers": {
"alphacast": {
"command": "npx",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
Reload VS Code after saving the file. For the hosted server instead, use the HTTP transport — VS Code handles the OAuth login:
```json .vscode/mcp.json theme={null}
{
"servers": {
"alphacast": {
"type": "http",
"url": "https://mcp.alphacast.io/mcp"
}
}
}
```
## Zed
Zed configures MCP servers in its `settings.json` under `context_servers`.
```json theme={null}
{
"context_servers": {
"alphacast": {
"command": {
"path": "npx",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
}
```
Zed runs context servers as local processes, so use the `mcp-remote` bridge to reach the hosted server: set `"path": "npx"` and `"args": ["-y", "mcp-remote", "https://mcp.alphacast.io/mcp"]`, with no `env` block.
## Windsurf
Windsurf MCP servers are configured in `~/.codeium/windsurf/mcp_config.json`:
```json theme={null}
{
"mcpServers": {
"alphacast": {
"command": "npx",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
For the hosted server, Windsurf accepts a remote URL directly:
```json theme={null}
{
"mcpServers": {
"alphacast": {
"serverUrl": "https://mcp.alphacast.io/mcp"
}
}
}
```
## Custom clients
You have two options when building your own MCP client with the [official SDKs](https://modelcontextprotocol.io/clients):
* **Hosted** — connect over the Streamable HTTP transport to `https://mcp.alphacast.io/mcp`. The endpoint is an OAuth 2.0 protected resource (authorization-code + PKCE against `https://auth.alphacast.io/`); it advertises its metadata at `/.well-known/oauth-protected-resource` and supports Dynamic Client Registration, so a spec-compliant client can discover and complete the flow automatically. Present the resulting token as a `Bearer` header.
* **Local** — spawn the server as a child process (`npx -y @alphacast/mcp`) with `ALPHACAST_API_KEY` in the environment, then connect via the SDK's stdio transport. No other handshake or registration step is required.
# MCP Examples
Source: https://learn.alphacast.io/mcp/examples
End-to-end prompt walkthroughs that combine multiple Alphacast MCP tools to solve realistic discovery and data-fetching tasks.
These walkthroughs show the kinds of prompts that work well against the Alphacast MCP server. Each one uses several tools in sequence — your client (Claude Code, Codex, etc.) decides the order based on the prompt, but the underlying tool calls are noted so you can debug if something looks off.
New to phrasing requests for the MCP? Start with [Writing better prompts](/mcp/prompting) — the five guidelines, copy-paste templates, and the preview-before-commit pattern for write actions.
## Find inflation series and download them
> "Find the latest Argentina inflation series in the Alphacast catalog, then download the most recent one as CSV."
What the model does:
1. **`search_catalog`** with `query: "Argentina inflation"` and `asset: "datasets"`.
2. Picks the top result and confirms with **`get_dataset`** to verify columns and date range.
3. Calls **`download_dataset`** with `format: "csv"` to get the rows.
Tips:
* Add `excludeDeprecated: true` to the search if you want only currently-maintained series.
* If your model is going to summarize the data instead of save it, ask for `format: "json"` so it can iterate over rows directly.
***
## Profile a dataset before downloading
> "Profile dataset 12345 and tell me if it's worth downloading — what entities does it cover and how fresh is it?"
What the model does:
1. **`get_dataset_profile`** with `datasetId: 12345` and `sampleRows: 5`.
2. Reports the entity breakdown, date range and frequency, total row count, and a small sample — without downloading the full dataset.
Tips:
* Profiling is much faster than downloading when you just need to decide whether a dataset is relevant.
* Combine with `search_catalog` to profile multiple search results in sequence before committing to a full download.
***
## Author a chart from an existing pipeline
> "Show me how to configure a line chart for pipeline 4821, validate the config, and add it as a chart-data step."
What the model does:
1. **`get_pipeline`** with `pipelineId: 4821` to see the step list and output columns.
2. **`get_grapher_config_reference`** with `chartType: "LineChart"` to get the minimal config template and text length limits.
3. Fills in the template using column names from the pipeline's output.
4. **`validate_grapher_config`** with `pipelineId: 4821` and `stepOrder` to confirm the config is valid against the actual upstream data.
5. **`add_pipeline_step`** to append a `chart-data` step with the validated config.
Tips:
* Always validate before adding the step — the validator catches missing column references and invalid option values that would fail silently otherwise.
* Use **`get_chart_details`** on an existing chart to clone its style rather than building from scratch.
***
## Catalog discovery for a research question
> "I want to research how Brazil's central bank rate compares to inflation. Find the relevant series across providers and tell me which combinations are available."
What the model does:
1. **`list_providers`** with `query: "Brazil"` to surface BCB, IBGE, etc.
2. For each candidate provider: **`browse_provider`** to find the relevant categories.
3. **`search_provider`** with focused keywords (`"selic"`, `"IPCA"`).
4. **`get_series`** on the top candidates to confirm date range and frequency.
5. Reports the combinations that align in frequency and date coverage.
Tips:
* Use `search_provider` to narrow results before fetching full series data — it keeps the conversation fast and avoids token bloat.
* If two providers carry the same series, prefer the one whose `license` field is most permissive for your use case.
***
## Compare a series across multiple providers
> "Find unemployment rate series for the United States from FRED, BLS, and OECD. Pull a recent preview from each and tell me how they differ."
What the model does:
1. **`search_provider`** on `fred` with `query: "unemployment rate"`, then on `bls` and `oecd` with similar queries.
2. **`get_series`** on the top candidate from each provider.
3. Compares frequency, seasonal adjustment, and date coverage across the three.
Tips:
* The same indicator can have different methodology across providers (e.g., seasonally adjusted vs. raw, monthly vs. quarterly). The metadata returned by `get_series` calls this out — read it before treating the series as interchangeable.
# Alphacast MCP Server
Source: https://learn.alphacast.io/mcp/overview
Connect Claude Code and Codex to Alphacast. Search the catalog, download datasets, browse 30+ data providers, look up tickers, and build pipelines from natural-language prompts.
The Alphacast Model Context Protocol (MCP) server lets AI coding agents interact with the Alphacast platform through structured tool calls. Search the curated catalog, download dataset rows, browse 30+ external data providers, look up market tickers, and build full data pipelines — all from inside Claude Code or Codex.
## Two ways to connect
The same 32 tools are available through two transports. Pick whichever fits your client and environment — both expose identical functionality.
Point your client at `https://mcp.alphacast.io/mcp`. Nothing to install — no Node.js, no npm, no API key. You sign in once through your browser with **OAuth** and your Alphacast account. Best for most users and for clients that support remote MCP servers.
Your client spawns the `@alphacast/mcp` package as a local subprocess via `npx -y @alphacast/mcp` over stdio. Requires Node.js 18+ and an `ALPHACAST_API_KEY`. Best for offline-ish setups, CI, or clients that don't yet support remote servers or OAuth.
| | Hosted (remote) | Local (npm) |
| - | - | - |
| Endpoint | `https://mcp.alphacast.io/mcp` | `npx -y @alphacast/mcp` (stdio) |
| Requirements | A browser to sign in | Node.js 18+ installed |
| Authentication | OAuth (browser login) | `ALPHACAST_API_KEY` env var |
| Tools | All 32 | All 32 |
Both authenticate as your Alphacast account and respect the same repository permissions. See [Authentication](/mcp/authentication) for the details of each, then follow the [Quickstart](/mcp/quickstart) or your client's [configuration guide](/mcp/configuration/claude-code).
## What you can do
Search the curated Alphacast catalog. Browse 30+ providers — FRED, BLS, World Bank, OECD, IMF, BIS, ECB, Eurostat, Banxico, and many more — without learning each provider's native API.
Download dataset rows in CSV or JSON, fetch column schemas, and inspect repository metadata. The workspace's default repository is resolved automatically when you don't specify one.
Search public market tickers, ETFs, indexes, and ISINs, then pull historical OHLCV prices over `5y`, `ytd`, `max`, and other lookback periods.
Create pipelines, add or edit steps, run them, and preview the output of any step. Auto-validates and auto-runs after every mutation.
Walk hierarchical catalogs, search series by keyword, and preview or fetch full historical data.
Look up chart-authoring recipes for any Grapher chart type, validate configurations before saving, and inspect existing chart metadata.
## Get started
Connect a client and run your first prompt in under five minutes.
Step-by-step setup for Claude Code and Codex.
All 32 tools, grouped by capability, with input schemas and example prompts.
End-to-end walkthroughs that combine multiple tools to solve real research workflows.
## Safety boundaries
The server intentionally does **not** expose destructive operations. Repositories, datasets, and pipelines can only be deleted from the Alphacast web UI — never from an agent. Of the 32 tools, 28 are read-only; the 4 write tools (`create_pipeline`, `add_pipeline_step`, `edit_pipeline_step`, `delete_pipeline_step`) are scoped to pipeline authoring. Provider API keys are managed through the [Alphacast settings](https://www.alphacast.io/settings) web UI.
# Writing better prompts
Source: https://learn.alphacast.io/mcp/prompting
How to frame requests so the Alphacast MCP returns exactly the data, pipeline, or diagnostic you need — five guidelines, a broad-to-precise example, copy-paste templates, and the safety pattern for write actions.
You don't need a rigid formula. The clearer the frame, the more direct and useful the result. You set the goal; the assistant reasons; the MCP does the heavy lifting against Alphacast. This page shows how to phrase requests so you spend less time re-asking and more time using the data.
## Five guidelines for better results
Say what you want to do: **find**, **compare**, **quality-check**, **download**, or **build a process**. The verb sets the whole task.
Pin down **country, variable, source, and unit**. If you know the dataset name or ID, even better — it removes ambiguity between similar series.
State whether you need **daily, monthly, quarterly, or annual** data. Mixing frequencies is a common cause of surprising results.
Give the **dates** and say **where to look**: your repositories, the general catalog, or one specific provider.
Ask for the shape you want back: a **table**, a **download**, a **diagnostic**, a **chart**, or a **pipeline proposal**. For a large task, split the message into **context, task, and acceptance criteria**; if it has several stages, number them and validate the intermediate results before moving on.
## From a broad ask to a precise one
The same question, sharpened in three steps:
> "How's inflation doing?"
Missing country, source, frequency, period, and expected output — the model has to guess on every axis.
> "Give me Argentina's monthly inflation for the last year."
Now country and frequency are defined, but there may still be different sources and versions.
> "In the Alphacast catalog, identify the monthly INDEC National CPI dataset. Give me the month-over-month change for 2024 in a table, and flag any missing observations or base changes. Include source, IDs, unit, and the latest available date."
Indicator, source, frequency, period, format, and quality checks are all defined — so is what "done" looks like.
## Templates to copy
```text Data query theme={null}
In the Alphacast catalog, find the monthly EMAE dataset from INDEC.
1. Show me the candidates and confirm which one is the seasonally adjusted general level.
2. Tell me the latest date it reaches.
3. Give me 2023 and 2024 in a table with date and value.
4. Include source, IDs, unit, and any transformation applied.
```
```text Pipeline change theme={null}
On pipeline 4319, I want to add a step that multiplies the variables by 100.
1. Show me the current steps and their order.
2. Propose where the new step goes and explain its impact.
3. Preview the output.
4. Don't save, run, or publish until I confirm.
```
## Traceability: ask where the data came from
Every result can carry what you need to verify, cite, and reuse it. Ask for it explicitly and the model will include it:
* Source and dataset name
* Dataset and variable IDs
* Unit, frequency, and period
* Latest available observation
* Formulas and transformations applied
* Missing values, assumptions, and warnings
A ready-to-use closer for any data prompt:
> "Include source, IDs, unit, frequency, latest available date, and the transformations applied."
## Preview before you commit
For any action that changes Alphacast — creating or editing a pipeline, saving, running, or publishing — ask the model to **show what it will change, preview the result, and wait for your confirmation** before it writes anything.
A phrase that works well in write-capable clients:
> "Show me the proposed change and a preview first. Don't save, run, or publish until I say so."
The MCP surface is read-only except for the four pipeline write tools, and destructive actions (deleting repositories, datasets, or pipelines) are never exposed to an agent — but the preview-first habit still keeps edits predictable. See [Safety boundaries](/mcp/tools/overview#safety-boundaries) for the full list.
## Who does what
Understanding the division of labor helps you phrase requests — and know when something is genuinely out of scope rather than a bad prompt.
| Actor | Role |
| - | - |
| 🧠 **The AI assistant** | Understands the request, organizes the task, and analyzes the results. |
| 🔌 **The Alphacast MCP** | Gives the assistant the tools to search, read, and operate on Alphacast and its enabled providers. |
| α **The Alphacast platform** | Manages permissions, stores datasets and charts, and runs or publishes pipelines. |
Every task falls into one of three buckets:
Search, download, transform, and operate on Alphacast within your permissions.
Reading an attached file, creating an Excel or document, generating an image, or browsing the web.
Bypassing permissions, modifying the original source, or inventing data that doesn't exist.
A few limits are worth keeping in mind:
* **It works with your permissions.** The MCP can only reach resources your account is authorized for.
* **Freshness depends on the source.** It retrieves the latest available observation but can't produce a data point that hasn't been published yet.
* **Detecting isn't always explaining.** It can flag a jump or a pattern change, but pinning down the cause may require checking metadata or official documentation.
## If the answer isn't what you expected
You can course-correct inside the same conversation — no need to start over:
* **Refine** — "same series, but seasonally adjusted."
* **Narrow** — "only from 2020, monthly frequency."
* **Ask for alternatives** — "show me the candidate series before picking one."
* **Ask for traceability** — "tell me which dataset it came from and what transformation you applied."
* **Split the task** — search and validate first; transform or publish afterward.
* **Stop a change** — if something isn't clear, tell it not to run and to show the proposal again.
## Next steps
End-to-end walkthroughs that combine several tools to solve realistic tasks.
The full list of MCP tools, grouped by capability, with input schemas.
# MCP Quickstart
Source: https://learn.alphacast.io/mcp/quickstart
Connect Claude Desktop, Claude Code, or Codex to the Alphacast MCP server in three steps and run your first prompt.
The Alphacast MCP server can be reached two ways: the **hosted** server at `https://mcp.alphacast.io/mcp` (no install, sign in with OAuth) or the **local** npm package (`@alphacast/mcp`) that your client runs via `npx`. Both expose the same 32 tools. Pick one path below.
## Option A — Hosted (recommended, no install)
Nothing to install and no API key to copy. Your client connects to the remote URL and you authorize it in the browser with your Alphacast account.
**Claude Code**: run this in a terminal.
```bash theme={null}
claude mcp add --transport http alphacast https://mcp.alphacast.io/mcp
```
**Claude Desktop**: open **Settings → Connectors → Add custom connector**, name it `alphacast`, and paste the URL `https://mcp.alphacast.io/mcp`. See the [Claude Desktop guide](/mcp/configuration/claude-desktop).
For Codex, Cursor, and other clients, see their [configuration guides](/mcp/configuration/cursor) — each shows the remote URL setup.
The first time the client connects, it opens your browser to `auth.alphacast.io`. Sign in (or approve if already signed in) and grant the requested `mcp:read` / `mcp:write` scopes. The client stores the token and reconnects automatically afterwards.
In Claude Code, if the browser doesn't open on its own, run `/mcp`, select `alphacast`, and choose **Authenticate**.
> "List my Alphacast repositories."
The client should call `list_repositories` and display the result. If you get a `401`, re-run the OAuth step — the token may have expired or been declined.
## Option B — Local (npm package)
Runs the server as a local subprocess. Requires Node.js 18+ and an API key.
Sign in to Alphacast and open [Settings](https://www.alphacast.io/settings) to copy your API key (or generate a new one). If you belong to multiple teams, make sure your active team subscription is selected first. The same key you use for the REST API works for the MCP server.
Treat the key like a password. It grants the same permissions as your account. Store it in a secrets manager or an environment variable, not in source control.
**Claude Code**: run this command in a terminal.
```bash theme={null}
claude mcp add alphacast -e ALPHACAST_API_KEY=YOUR_API_KEY -- npx -y @alphacast/mcp
```
**Claude Desktop**: follow the [Claude Desktop guide](/mcp/configuration/claude-desktop) — it walks through editing `claude_desktop_config.json` step by step, including non-standard install paths. For Codex, Cursor, and other clients, see [Configuration](/mcp/configuration/cursor).
Restart the client so it picks up the new server, then try a prompt that uses one of the tools:
> "List my Alphacast repositories."
The client should call `list_repositories` and display the result. If you see an authentication error, double-check that the `ALPHACAST_API_KEY` environment variable is set correctly in the previous step.
## What's next
Browse all 32 tools and their input schemas.
See full prompts that combine search, download, and provider tools.
# Grapher & Chart Tools
Source: https://learn.alphacast.io/mcp/tools/grapher
Tools for looking up chart-authoring recipes, validating Grapher configurations, and inspecting existing chart metadata. Three read-only tools.
Three read-only tools for working with Alphacast Grapher charts. Use them to discover how to configure a chart type, validate a configuration object before saving, and inspect an existing chart's metadata and config.
## `get_grapher_config_reference`
Returns chart-authoring recipes, minimal configuration examples, text length limits, and common pitfalls for a given chart type. Use this before building or editing a `chart-data` pipeline step to understand what the Grapher expects.
The chart type to query. Examples: `"LineChart"`, `"ScatterPlot"`, `"Map"`, `"DiscreteBar"`.
Level of detail. `"default"` returns compact authoring recipes and minimal examples. `"full"` includes exhaustive field definitions for the chart type.
Response includes `availableChartTypes`, `minimalCreationConfig`, `editRecipes`, `textLengthLimits` (title ≤ 100 chars, subtitle ≤ 140, footer note ≤ 140), and `pitfalls`.
**Example prompt**
> "What's the minimal config for a line chart in Alphacast Grapher?"
***
## `validate_grapher_config`
Validates a `chart-data` step configuration or a raw Grapher config object against the schema. Returns errors and warnings without saving anything. Use this to check your config before passing it to `edit_pipeline_step` or `add_pipeline_step`.
The configuration object to validate. Can be a `chart-data` step configuration or a raw Grapher config (set `validateRawGrapher: true` for the latter).
Upstream output columns (`name`, `isEntity`, `dataType`). Helps the validator check that referenced columns exist. When omitted and `pipelineId` + `stepOrder` are provided, the manifest is derived automatically.
Pipeline ID. Used together with `stepOrder` to automatically derive the upstream output manifest.
0-based step order of the chart-data step. Used together with `pipelineId`.
When `true`, treats `configuration` as a raw Grapher config object rather than a `chart-data` step configuration.
Response includes `valid` (boolean), `issues` (array of `{severity, code, message, path}`), and `context` with the resolved output manifest.
**Example prompt**
> "Validate this chart config before I save it to the pipeline."
***
## `get_chart_details`
Fetches a chart's metadata and its full Grapher configuration from a chart URL or slug. Also returns pipeline ownership when the chart is backed by a pipeline step, so you can navigate directly to the editor.
Full Alphacast chart URL (e.g. `https://www.alphacast.io/p/account/charts/chart-slug-12345`) or just the chart slug.
Response includes `chartId`, `slug`, `title`, `chartUrl`, the full `grapher` config object, and an optional `pipeline` block with `pipelineId`, `stepId`, and `editUrl`.
**Example prompt**
> "Show me the Grapher config of the chart at [https://www.alphacast.io/charts/12345](https://www.alphacast.io/charts/12345) — I want to replicate its style."
**Underlying endpoint:** `GET /charts/{id}/config`.
# MCP Tools Overview
Source: https://learn.alphacast.io/mcp/tools/overview
Reference for all 32 tools exposed by the Alphacast MCP server, grouped by capability: search & datasets, providers, tickers, grapher & charts, and pipelines.
The Alphacast MCP server exposes 32 tools across five functional areas. Use this page as a high-level map; click any tool name to jump to its full input schema and example prompt on the corresponding detail page.
## All tools
| Tool | Group | Access | Summary |
| - | - | - | - |
| [`search_catalog`](/mcp/tools/search-and-datasets#search_catalog) | Search & datasets | Read | Search the curated Alphacast catalog or all public repositories. |
| [`get_dataset`](/mcp/tools/search-and-datasets#get_dataset) | Search & datasets | Read | Retrieve dataset metadata and column schema. |
| [`get_dataset_profile`](/mcp/tools/search-and-datasets#get_dataset_profile) | Search & datasets | Read | Comprehensive dataset inspection: columns, entities, date range, row count, and sample rows. |
| [`download_dataset`](/mcp/tools/search-and-datasets#download_dataset) | Search & datasets | Read | Download dataset rows as JSON or CSV. |
| [`list_datasets`](/mcp/tools/search-and-datasets#list_datasets) | Search & datasets | Read | List every dataset the API key can access. |
| [`list_repositories`](/mcp/tools/search-and-datasets#list_repositories) | Search & datasets | Read | List repositories where the API key has Write access or higher. |
| [`get_repository`](/mcp/tools/search-and-datasets#get_repository) | Search & datasets | Read | Retrieve repository metadata and your permission level. |
| [`get_default_repository`](/mcp/tools/search-and-datasets#get_default_repository) | Search & datasets | Read | Resolve the current/default writable repository for the active workspace — used implicitly when other tools accept an optional `repositoryId`. |
| [`list_providers`](/mcp/tools/providers#list_providers) | Providers | Read | List all external data providers, or the top 5 matching a keyword. |
| [`get_provider`](/mcp/tools/providers#get_provider) | Providers | Read | Retrieve a provider's parameters, popular series, and key requirements. |
| [`browse_provider`](/mcp/tools/providers#browse_provider) | Providers | Read | Walk a provider's hierarchical catalog by path. |
| [`search_provider`](/mcp/tools/providers#search_provider) | Providers | Read | Search series within a provider by keyword. |
| [`get_series`](/mcp/tools/providers#get_series) | Providers | Read | Fetch full historical data for a provider series. |
| [`search_tickers`](/mcp/tools/tickers#search_tickers) | Tickers | Read | Search public market tickers, ETFs, indexes, and ISINs by keyword. |
| [`get_ticker`](/mcp/tools/tickers#get_ticker) | Tickers | Read | Retrieve a single ticker's profile metadata. |
| [`get_ticker_data`](/mcp/tools/tickers#get_ticker_data) | Tickers | Read | Pull historical OHLCV price data over a lookback period. |
| [`get_grapher_config_reference`](/mcp/tools/grapher#get_grapher_config_reference) | Grapher & Charts | Read | Returns chart-authoring recipes, minimal configs, and text length limits for a chart type. |
| [`validate_grapher_config`](/mcp/tools/grapher#validate_grapher_config) | Grapher & Charts | Read | Validates a chart-data or raw Grapher configuration object. |
| [`get_chart_details`](/mcp/tools/grapher#get_chart_details) | Grapher & Charts | Read | Fetches chart metadata and Grapher config from a chart URL or slug. |
| [`list_pipelines`](/mcp/tools/pipelines#list_pipelines) | Pipelines | Read | List pipelines in a repository; defaults to the current/default writable repository when none is given. |
| [`get_pipeline`](/mcp/tools/pipelines#get_pipeline) | Pipelines | Read | Get full pipeline definition, step list, validation status, and last-run summary. |
| [`get_pipeline_run`](/mcp/tools/pipelines#get_pipeline_run) | Pipelines | Read | Retrieve a specific pipeline run with status and per-step logs. |
| [`wait_pipeline_run`](/mcp/tools/pipelines#wait_pipeline_run) | Pipelines | Read | Poll a run until it reaches a terminal state and return logs. |
| [`get_step_data`](/mcp/tools/pipelines#get_step_data) | Pipelines | Read | Fetch the cached output of a step without triggering a run. |
| [`get_step_preview`](/mcp/tools/pipelines#get_step_preview) | Pipelines | Read | Materialize a fresh preview for a step and return rows as CSV. |
| [`list_pipeline_step_types`](/mcp/tools/pipelines#list_pipeline_step_types) | Pipelines | Read | Lists all available pipeline step types and their groups. |
| [`get_pipeline_step_config`](/mcp/tools/pipelines#get_pipeline_step_config) | Pipelines | Read | Returns the configuration schema for a specific step type. |
| [`get_pipeline_formula_reference`](/mcp/tools/pipelines#get_pipeline_formula_reference) | Pipelines | Read | Formula syntax and built-in functions reference for calculate-variable and apply-formula steps. |
| [`create_pipeline`](/mcp/tools/pipelines#create_pipeline) | Pipelines | Write | Create a new pipeline, optionally with initial steps. Defaults to the workspace's default repo. |
| [`add_pipeline_step`](/mcp/tools/pipelines#add_pipeline_step) | Pipelines | Write | Append or insert a step into a pipeline. |
| [`edit_pipeline_step`](/mcp/tools/pipelines#edit_pipeline_step) | Pipelines | Write | Replace the configuration of an existing step. |
| [`delete_pipeline_step`](/mcp/tools/pipelines#delete_pipeline_step) | Pipelines | Write | Remove a step from a pipeline. |
## Safety boundaries
The MCP surface is read-only **except** for the four pipeline write tools (`create_pipeline`, `add_pipeline_step`, `edit_pipeline_step`, `delete_pipeline_step`). Deleting repositories, datasets, or whole pipelines is intentionally **not** exposed — those actions are only available from the Alphacast web UI, never from an agent. Provider API keys are managed through the [Alphacast settings](https://www.alphacast.io/settings) web UI.
## Tool conventions
* **IDs** are always numeric (`integer`). Tools accept strings and coerce them — `"42"` works the same as `42`.
* **Formats** for downloads: `json` (default for `download_dataset`) or `csv`. For pipeline step output the default is `csv`.
* **Permissions** mirror the REST API. The API key's permission on each repository determines which tools succeed.
* **Default repository fallback.** When a tool accepts an optional `repositoryId` (for example `create_pipeline` or `list_pipelines`), omitting it resolves to the current/default writable repository for the active workspace automatically — the server does not interrupt to ask.
## Underlying API
Each tool maps to one or more endpoints in the Alphacast REST API. The mapping is documented on each tool's detail page. You don't need to call those endpoints yourself — the MCP server is the recommended interface for programmatic access.
# Pipeline Tools
Source: https://learn.alphacast.io/mcp/tools/pipelines
Build, inspect, edit, and run Alphacast pipelines from natural-language prompts. Thirteen MCP tools for the full pipeline lifecycle — nine read-only, four write — with auto-validation and auto-run after every mutation.
Thirteen tools for working with Alphacast pipelines from an MCP client. Nine are read-only (inspect definitions, fetch runs, preview step output, discover step types and formulas); four are write (create a pipeline, add/edit/remove steps). After every write the server auto-validates and auto-runs the pipeline, then waits for the editor run to finish so the response carries the new state.
When `repositoryId` is omitted from `create_pipeline` or `list_pipelines`, the server resolves the workspace's **default repository** automatically. You don't need to call `list_repositories` first unless the pipeline belongs somewhere else.
## `list_pipelines`
List pipelines in a repository.
Repository ID. **Optional** — when omitted, the MCP server resolves and uses the workspace's default writable repository. The tool returns only pipelines that belong to the resolved repository.
Returns one row per pipeline with `id`, `name`, and `repositoryId`.
**Example prompt**
> "List the pipelines in my default repository."
**Underlying endpoint:** `GET /pipelines?repositoryId={id}`.
***
## `get_pipeline`
Get the full definition of a pipeline: name, repository, every step in order with its type and configuration, validation errors, and a deep link to each step in the editor. Also returns a summary of the last run if one exists.
Numeric pipeline ID.
Validation errors that depend on a fresh run are marked `PENDING RUN` instead of `ERROR`, so the response distinguishes "step is broken" from "step needs the upstream to materialize first."
**Example prompt**
> "Show me pipeline 4821 — what does each step do and is anything broken?"
**Underlying endpoint:** `GET /pipelines/{id}` (plus the last run, fetched in parallel).
***
## `get_pipeline_run`
Get a specific run by ID, including status, timestamps, and per-step logs.
Pipeline ID.
Run ID (from the pipeline's run history).
**Example prompt**
> "What happened in run 91722 of pipeline 4821? Did step 3 fail?"
**Underlying endpoint:** `GET /pipelines/{id}/runs/{runId}`.
***
## `wait_pipeline_run`
Block until a specific run reaches a terminal state (`completed`, `failed`, `cancelled`, or `skipped`) and return its status and logs. Useful when you just triggered a run via the web UI or another tool and want to poll exactly that run instead of guessing which is the latest.
Pipeline ID.
Run ID to wait on.
Maximum seconds to poll before returning `timeout`. The tool polls every 2 seconds.
**Example prompt**
> "Wait up to 2 minutes for run 91722 to finish and tell me how it ended."
**Underlying endpoints:** `GET /pipelines/{id}/runs/{runId}/status` (polled) and `GET /pipelines/{id}/runs/{runId}/logs` (fetched once terminal).
***
## `get_step_data`
Fetch the cached output of a single pipeline step directly, without triggering a new run. Returns the materialized data of the most recent successful run.
Pipeline ID.
Step ID (from `get_pipeline`).
`csv` for tabular text (default) or `json` for structured data.
**Example prompt**
> "Get the CSV output of step 11 in pipeline 4821."
**Underlying endpoint:** `GET /pipelines/{id}/steps/{stepId}/data`.
***
## `get_step_preview`
Run a fresh **editor preview** materialization for a step, poll the run to completion, and return the preview rows as CSV. Use this when you want the output of a step *right now* — for example after editing its configuration — rather than reading whatever was cached last.
Pipeline ID.
0-based order of the step to preview. The pipeline runs up to and including this step.
Maximum number of preview rows to return. Output is truncated at \~10 000 characters regardless of `top`.
**Example prompt**
> "Preview the data after step 2 in pipeline 4821 — first 50 rows."
**Underlying endpoints:** `POST /pipelines/{id}/steps/{stepId}/editor-preview-data` (triggers the run) and `GET /pipelines/{id}/steps/{stepId}/editor-preview-data` (fetches the materialized rows once the run completes).
***
## `list_pipeline_step_types`
Lists all available pipeline step types grouped by category (data fetch, data shaping, filtering, transformation, AI, analysis, output/views, validation). Use this to discover what types are available before calling `add_pipeline_step` or `create_pipeline`.
No input parameters. Returns a structured list of step type groups, each containing type IDs, labels, and descriptions.
**Example prompt**
> "What pipeline step types are available in Alphacast?"
**Underlying endpoint:** `GET /api/pipelines/assistant/reference?section=step-types`.
***
## `get_pipeline_step_config`
Returns the configuration schema, validation rules, and AI-facing authoring examples for a specific pipeline step type. Use this to understand what `configuration` object to pass when calling `add_pipeline_step` or `edit_pipeline_step`.
The step type ID (e.g. `"fetch-dataset"`, `"fetch-fred"`, `"merge"`, `"ai-transform"`, `"calculate-variable"`, `"chart-data"`, `"publish"`).
**Example prompt**
> "What configuration fields does the `merge` step type accept?"
**Underlying endpoint:** `GET /api/pipelines/assistant/reference?stepType={type}`.
***
## `get_pipeline_formula_reference`
Returns the complete formula syntax and built-in functions reference for `calculate-variable`, `apply-formula`, and `filter-rows` pipeline steps. Covers arithmetic operators, column references (`#'Column Name'`), aggregation functions, date functions, and conditional logic.
No input parameters.
In raw MCP/API formulas, reference columns as `#'Column Name'` — not the `@Column` shorthand used in the visual editor.
**Example prompt**
> "What formula syntax can I use in a calculate-variable step?"
**Underlying endpoint:** `GET /api/pipelines/assistant/reference?section=formula`.
***
## `create_pipeline`
Create a new pipeline, optionally with initial steps. When `steps` are provided, the server validates and runs the pipeline before returning, so the response includes the run status and any validation errors.
Pipeline name.
Target repository. **Optional** — when omitted, the MCP server resolves and uses the workspace's default writable repository automatically.
Optional initial steps. Each entry has `type`, `order` (0-based), and `configuration` (a step-specific object).
Common step types and their configuration are documented in the tool's input schema. Highlights:
* `fetch-dataset { datasetId }`
* `fetch-yahoo { tickers, period }` — use [`search_tickers`](/mcp/tools/tickers#search_tickers) to discover symbols first
* `fetch-fred { series }`
* `merge { datasetId, how }`
* `transform { transformation, columns }` — built-in transformations with auto-fetched auxiliary data (USD conversion, constant prices, per capita, seasonal adjustment)
* `ai-transform { code }` — Python with `def run(df): return df, 'log'`
* `publish { datasetId }` or `publish { datasetName }`
**Example prompt**
> "Create a pipeline named 'US inflation YoY' that fetches FRED CPIAUCSL and applies a `pc1` transformation."
**Underlying endpoint:** `POST /pipelines`.
Writes are **not** reversible from MCP. Deleting a pipeline requires the Alphacast web UI — the agent surface does not expose `DELETE /pipelines/{id}`.
***
## `add_pipeline_step`
Append or insert a step into an existing pipeline. Auto-validates and auto-runs after the change.
Pipeline ID.
Step type. The tool's input schema enumerates every supported step type with its required configuration shape (`fetch-yahoo`, `fetch-fred`, `merge`, `transform`, `ai-transform`, `publish`, etc.).
0-based position in the pipeline. Use the next available order to append.
Step-specific configuration. For `calculate-variable`, reference columns as `#'Column Name'` in raw MCP/API formulas — not the `@Column` shorthand used in the visual editor.
**Example prompt**
> "Append an `ai-transform` step to pipeline 4821 that computes a 12-month rolling average of the `Value` column."
**Underlying endpoint:** `POST /pipelines/{id}/steps`.
***
## `edit_pipeline_step`
Replace the full configuration of an existing step. Auto-validates and auto-runs after the change. The new configuration replaces the old one entirely — partial updates are not supported.
Pipeline ID.
Step ID to edit.
Step type — must match the existing step's type.
Step order (0-based).
Full updated configuration for the step.
**Example prompt**
> "Change step 11 in pipeline 4821 to filter dates from 2010-01-01 onwards."
**Underlying endpoint:** `PUT /pipelines/{id}/steps/{stepId}`.
***
## `delete_pipeline_step`
Remove a step from a pipeline. The remaining steps keep their order numbers — you may want to reorder them with `edit_pipeline_step` afterwards. Auto-validates and auto-runs after the change.
Pipeline ID.
Step ID to remove.
**Example prompt**
> "Remove step 14 from pipeline 4821."
**Underlying endpoint:** `DELETE /pipelines/{id}/steps/{stepId}`.
***
## Common patterns
**Branching and merging.** Fetch source A, optionally reshape or resample it, then `stash`. Fetch source B, then `merge` with `{ stash: true, how: 'left', columns: [{ name: 'Date', matchTo: 'Date' }] }`. When the two sources have different frequencies, resample one branch first.
**Appending.** Fetch source A, `stash`, fetch source B, then `append-dataset` with `{ stash: true }`.
**Publish.** Use `publish { datasetId }` to write into an existing dataset, or `publish { datasetName }` to create a new dataset in the pipeline's repository.
# Provider Tools
Source: https://learn.alphacast.io/mcp/tools/providers
Tools for discovering 30+ external data providers (FRED, BLS, World Bank, OECD, IMF, BIS, ECB, Eurostat, and central banks across Latin America, Europe, and Asia), browsing their catalogs, and fetching series.
Five read-only tools for working with the external data providers Alphacast integrates with. Browse the live catalog at [alphacast.io/explore/apis](https://www.alphacast.io/explore/apis).
## `list_providers`
List every available provider, or search the top 5 by keyword.
Optional keyword. Omit to list every provider. With a keyword, returns the top 5 matches scored across slug, name, and description.
**Example prompt**
> "Which providers cover Latin American economic data?"
**Underlying endpoints:** `GET /providers` (no query) or `GET /providers/match?q=...` (with query).
***
## `get_provider`
Get full metadata for one provider, including its tunable parameters and curated popular series.
Provider slug. Examples: `fred`, `bls`, `worldbank`, `bcra`, `inegi`, `banxico`, `oecd`, `imf`, `bis`, `bcb-opendata`.
Response includes `parameters` (tunable knobs like FRED's `units` or `frequency`), `popular_series`, key requirements, and the `browse_root_label` for hierarchical navigation.
**Example prompt**
> "Tell me about the FRED provider — does it require a key?"
**Underlying endpoint:** `GET /providers/{slug}`.
***
## `browse_provider`
Walk a provider's hierarchical catalog by path. Only available for providers with the `hierarchical` capability.
Provider slug.
Slash-separated path inside the provider's tree. Omit to start at the root.
How many levels of children to return in one call. Maximum is 3.
When `true`, return paginated series at the current path instead of subfolders.
Page size when `series=true`.
Pagination offset when `series=true`.
**Example prompt**
> "Browse the World Bank Economy & Growth category two levels deep."
**Underlying endpoint:** `GET /providers/{slug}/browse`.
***
## `search_provider`
Search series within a single provider by keyword. Only for providers with the `search` capability.
Provider slug.
Search query.
Maximum number of results.
**Example prompt**
> "Search FRED for unemployment rate series and return the top 10."
**Underlying endpoint:** `GET /providers/{slug}/search`.
***
## `get_series`
Fetch the full historical data of one provider series.
Provider slug.
The provider's series identifier. Format varies: `UNRATE` for FRED, `CUUR0000SA0` for BLS, `NY.GDP.PCAP.CD` for World Bank.
Provider-specific parameters (FRED `units`, BLS `startyear`, etc.). See `get_provider` for valid keys.
**Example prompt**
> "Fetch the full FRED CPIAUCSL series as year-over-year percent change."
**Underlying endpoint:** `POST /providers/{slug}/series/{series_id}/data`.
***
## Managing provider API keys
Third-party API keys (FRED, BLS, INEGI, Banxico, BEA, EIA, BCCH, and others) are managed through the [Alphacast settings page](https://www.alphacast.io/settings). Once saved, every call to `get_series` for that provider uses the key automatically.
# Search & Datasets Tools
Source: https://learn.alphacast.io/mcp/tools/search-and-datasets
Tools for discovering content in the Alphacast catalog, reading dataset metadata, schemas, and rows, and resolving the workspace's default repository.
These eight tools cover discovery and read access. None of them mutate state, so you can safely chain them together to explore Alphacast.
## `search_catalog`
Search the curated Alphacast catalog (default) or every public repository.
Search query. Tokenized server-side; multi-word queries score every term.
Type of asset to return. One of `datasets`, `charts`, `insights`, `repositories`, `accounts`, `dashboards`, `series`, `tickers`.
Maximum number of results.
Pagination offset.
Optional list of tag slugs to filter by.
Optional repository ID to scope the search to a single repo.
Set to `true` to search every public repository instead of just the curated catalog.
When `true`, deprecated datasets are excluded from results.
**Example prompt**
> "Find Argentina inflation series in the curated catalog."
**Underlying endpoint:** `GET /api/search`.
***
## `get_dataset`
Retrieve dataset metadata and the column schema.
Numeric dataset ID. Strings are coerced.
Returns the dataset's name, description, repository, last update timestamp, and the column array (`name`, `dataType`, `isEntity`).
**Example prompt**
> "Show me the schema of dataset 12345."
**Underlying endpoints:** `GET /datasets/{id}` + `GET /datasets/{id}/columns` (called in parallel).
***
## `download_dataset`
Download the current rows of a dataset.
Numeric dataset ID.
`json` returns an array of objects. `csv` returns a CSV string.
Internally follows S3 redirects so the model receives the raw rows directly.
**Example prompt**
> "Download dataset 12345 as CSV and tell me the date range."
**Underlying endpoint:** `GET /datasets/{id}/data?$format=...`.
***
## `list_datasets`
List every dataset the API key can read.
No input parameters. Returns one row per dataset with `id`, `name`, `repositoryId`, and `frequency`.
**Example prompt**
> "List all datasets I have access to and pick the ones tagged 'Argentina'."
**Underlying endpoint:** `GET /datasets`.
***
## `list_repositories`
List repositories where the API key can publish (Owner, Admin, or Write).
No input parameters. Filtered server-side; read-only repositories are excluded so the model only sees repositories it can write to.
Tools that accept an optional `repositoryId` (for example [`create_pipeline`](/mcp/tools/pipelines#create_pipeline)) **default to the workspace's default repository** when no ID is provided — the server does not interrupt to ask you to pick one. Call `list_repositories` only when you want to write somewhere other than the default, or `get_default_repository` to check which repo the default resolves to.
**Example prompt**
> "Which repos can I publish into?"
**Underlying endpoint:** `GET /repositories` (with client-side permission filter).
***
## `get_repository`
Retrieve a single repository's metadata.
Numeric repository ID.
Returns name, description, privacy, your permission level, and timestamps.
**Example prompt**
> "What's the description of repository 1042 and who owns it?"
**Underlying endpoint:** `GET /repositories/{id}`.
***
## `get_default_repository`
Resolve the **default repository** — the current writable repository for this API key's active workspace, where pipelines and datasets land when no specific repository is named. Use it to inspect what the default points at before creating a pipeline, or to share its ID with collaborators.
No input parameters. Returns the repository as if you had called `get_repository` on it.
**Example prompt**
> "What's my default Alphacast repository?"
**Underlying endpoint:** `GET /repositories/default`.
***
## `get_dataset_profile`
Comprehensive inspection of a dataset: column schema, entity values, date range and frequency, total row count, and a sample of rows. Use this for a quick understanding of what a dataset contains before downloading it.
Numeric dataset ID.
Number of sample rows to include in the response. Maximum 50. Set to `0` to skip the sample entirely.
Returns `dataset` metadata, `columns`, `entities`, `dateStats` (date range and frequency), `rowCount`, and a `sample` array. Individual sections gracefully degrade if unavailable.
**Example prompt**
> "Profile dataset 12345 — how many rows does it have, what entities does it cover, and show me 5 sample rows."
**Underlying endpoints:** `GET /datasets/{id}` + `GET /datasets/{id}/columns` + `GET /datasets/{id}/entities` + `GET /datasets/{id}/date-stats` + `GET /datasets/{id}/data?$top=N` (called in parallel).
# Ticker Tools
Source: https://learn.alphacast.io/mcp/tools/tickers
Look up market tickers, ETFs, indexes, and ISINs from an MCP client, fetch their profile metadata, and pull historical price data. Three read-only tools that pair naturally with the fetch-yahoo pipeline step.
Three read-only tools for working with public market tickers. Use them to discover the right symbol from a free-text query, inspect a ticker's profile, and pull historical OHLCV data — for ad-hoc questions or to feed a pipeline.
Symbols returned by these tools drop straight into the `fetch-yahoo` step in pipelines: `{ type: "fetch-yahoo", configuration: { tickers: ["MSFT"], period: "5y" } }`. See [`create_pipeline`](/mcp/tools/pipelines#create_pipeline) and [`add_pipeline_step`](/mcp/tools/pipelines#add_pipeline_step).
## `search_tickers`
Search the public ticker catalog by company name, symbol, or ISIN. Returns the top matches with each symbol and short name.
Company name, ticker symbol, ETF or index symbol, or ISIN. Examples: `"MSFT"`, `"Microsoft"`, `"SPY"`, `"US0378331005"`.
Maximum number of matches to return.
**Example prompt**
> "Find tickers related to Microsoft and pick the primary listing."
**Underlying endpoint:** `GET /tickers/search/{query}`.
***
## `get_ticker`
Get the profile and metadata for a single ticker — exchange, asset class, sector, currency, and similar fields. Use it to confirm you have the right symbol before pulling data.
Ticker symbol or ISIN. Examples: `"MSFT"`, `"AAPL"`, `"^GSPC"`.
**Example prompt**
> "What is `^GSPC` and what currency is it quoted in?"
**Underlying endpoint:** `GET /tickers/{symbol}`.
***
## `get_ticker_data`
Fetch historical price data (OHLCV) for a ticker over a fixed lookback period.
Ticker symbol or ISIN.
Historical lookback period. One of `1d`, `5d`, `1mo`, `3mo`, `6mo`, `1y`, `2y`, `5y`, `10y`, `ytd`, `max`.
Return only the most recent N rows. Useful for quick answers like "what was MSFT's close yesterday".
Response format: `json` or `csv`.
**Example prompt**
> "Pull the last 30 days of AAPL prices and tell me the high, low, and average close."
**Underlying endpoint:** `GET /tickers/{symbol}/data`.
***
## Tickers vs. providers
Tickers are a curated dataset of public market instruments maintained by Alphacast — they are **not** part of the external data providers surface ([`list_providers`](/mcp/tools/providers#list_providers), [`get_series`](/mcp/tools/providers#get_series), etc.). Use tickers for equity, ETF, index, and ISIN lookups; use providers for macroeconomic and statistical series.
# MCP Troubleshooting
Source: https://learn.alphacast.io/mcp/troubleshooting
Common errors and fixes when connecting clients to the Alphacast MCP server, authenticating, or running tools.
This page covers the failures you'll most likely run into. If your issue isn't here, check your client's MCP logs first — they almost always reveal the underlying HTTP status code or message.
## Setup issues
### `claude_desktop_config.json` is not where the docs say
Enterprise deployments of Claude Desktop can install under a different directory than the standard `%APPDATA%\Claude\` — for example `%LOCALAPPDATA%\Claude-3p\`. The documented paths are defaults, not guarantees.
**Fixes:**
* In Claude Desktop, open your profile → **Settings** → **Developer** → **Edit Config**. This always opens the folder containing the config file that *your* installation actually reads — use it instead of navigating to a hardcoded path.
* Alternatively, search for `claude_desktop_config.json` with Windows Search (or Spotlight on macOS).
### No admin rights to install Node.js (Windows)
The standard Node.js `.msi` installer requires administrator privileges, which many corporate machines don't allow. You don't need admin rights to run the MCP server — use the portable binary instead:
1. Download the **Windows Binary (.zip)** from [nodejs.org/en/download](https://nodejs.org/en/download) (choose "Standalone binary", not the installer).
2. Extract it to a folder you own, for example `C:\Users\\nodejs\`.
3. Add that folder to your **user-level PATH** (no admin needed): open the Start menu, search for **"Edit environment variables for your account"**, select `Path` → **Edit** → **New**, and add the folder. Then fully restart your MCP client so it picks up the new PATH.
4. Verify in a new terminal: `npx --version`.
If you can't (or don't want to) modify PATH, skip step 3 and point your MCP config at the binary directly with an absolute path:
```json theme={null}
{
"mcpServers": {
"alphacast": {
"command": "C:\\Users\\\\nodejs\\npx.cmd",
"args": ["-y", "@alphacast/mcp"],
"env": {
"ALPHACAST_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
Note the doubled backslashes — JSON requires `\\` for each `\` in Windows paths.
### The config JSON is invalid (server disappears or never loads)
If your client ignores the server after a restart — it doesn't appear in the server list at all — the config file is almost certainly malformed JSON.
**Common causes:**
* A missing comma between two server entries, or an extra trailing comma after the last one.
* Unbalanced braces after pasting a snippet into an existing file.
* The file was saved as `claude_desktop_config.json.txt` (Windows hides extensions by default).
**Fixes:**
* Paste the full file content into a Claude chat and ask it to find and fix the JSON error — this catches formatting mistakes immediately.
* If it still fails, replace the entire file content with the complete config block from the [Claude Desktop guide](/mcp/configuration/claude-desktop) instead of merging snippets.
* When saving with **Save As** on Windows, set "Save as type" to **All Files** to avoid the hidden `.txt` extension.
## Authentication errors
### Hosted server: browser login doesn't open or won't complete
On the hosted server (`https://mcp.alphacast.io/mcp`) the first connection triggers an OAuth login in your browser. If nothing opens, or the flow never finishes:
**Fixes:**
* In Claude Code, run `/mcp`, select `alphacast`, and choose **Authenticate** to trigger the login manually. In Cursor, open **Settings → MCP** and click the server's **Login** button.
* If the browser opened but the page errored, make sure you can reach `https://auth.alphacast.io` and `https://www.alphacast.io` directly (a VPN or proxy may block them).
* Using the `mcp-remote` bridge? Clear its cached state and retry: delete the `~/.mcp-auth` folder, then restart the client so a fresh login is requested.
* Confirm your client actually supports remote MCP servers. If it doesn't, reach the hosted server through the [`mcp-remote` bridge](/mcp/configuration/other-clients#hosted-remote-oauth) instead, or use the local npm package.
### Hosted server: `401 Unauthorized` after it was working
The OAuth token expired or was revoked, and the client didn't refresh it.
**Fixes:**
* Re-authenticate: in Claude Code run `/mcp → alphacast → Authenticate`; in other clients, reconnect / log in again from the MCP settings.
* If you revoked the session in your Alphacast account, that's expected — sign in again to mint a new token.
* For the `mcp-remote` bridge, delete `~/.mcp-auth` and restart the client to force a fresh login.
### Local server: `401 Unauthorized` on every tool call
The `ALPHACAST_API_KEY` environment variable is missing, empty, or the key is invalid. (This applies to the local npm package; the hosted server uses OAuth — see above.)
**Fixes:**
* Verify the key is set in your client's MCP configuration under `"env": { "ALPHACAST_API_KEY": "..." }`.
* Regenerate the key in [Alphacast → Settings](https://www.alphacast.io/settings) if the original was rotated, leaked, or revoked.
* For Claude Code, run `claude mcp list` and confirm the environment variable is configured correctly.
* For Codex, run `codex mcp list` and verify the `env` block in your `config.toml`.
### `403 Forbidden` on a specific tool call
Authentication succeeded (OAuth token or API key) but your account does not have the permission required for this action.
**Fixes:**
* Read access required: ensure your account has at least Read permission on the target repository.
* Write tools (pipeline authoring) need Write access on the repository, and — on the hosted server — the `mcp:write` scope, which is granted during the OAuth consent step.
* Have the repository owner grant your account the missing permission level.
## Quota errors
### `402 Payment Required`
The action exceeds your plan's quota — typically downloads or paid-tier provider usage.
**Fix:** upgrade your subscription, or wait until the quota resets. See [Error codes](/api/errors#402-payment-required).
## Connection errors
### Hosted server: client can't connect to the URL
The client can't establish the Streamable HTTP connection to `https://mcp.alphacast.io/mcp`.
**Fixes:**
* Confirm the URL is exact — `https://mcp.alphacast.io/mcp`, including the `/mcp` path. A trailing typo or a missing path returns a 404 the client reports as a connection failure.
* Check outbound network access to `mcp.alphacast.io` and `auth.alphacast.io` on port 443: `curl -I https://mcp.alphacast.io/mcp` should return `401` (auth required), not a timeout or DNS error.
* If your client doesn't support remote MCP servers at all, it will silently ignore the `url` field. Use the [`mcp-remote` bridge](/mcp/configuration/other-clients#hosted-remote-oauth) or the local npm package instead.
### Local server: client says "MCP server failed to start" or shows a red status
The client could not spawn the `npx -y @alphacast/mcp` subprocess.
**Fixes:**
* Ensure **Node.js 18+** is installed and `npx` is on your system PATH. Run `npx --version` in a terminal to check. No admin rights to install it? See [the portable install](#no-admin-rights-to-install-nodejs-windows).
* Verify the command in your MCP config: `"command": "npx"`, `"args": ["-y", "@alphacast/mcp"]`.
* On Windows, if `npx` is not on PATH, use the full path to `npx.cmd` as the command, e.g. `"command": "C:\\Program Files\\nodejs\\npx.cmd"` (or wherever Node is installed — note the doubled backslashes).
* Check your client's MCP logs for the specific error message (e.g., run `claude mcp list` in Claude Code or `codex mcp list` in Codex).
### Server shows "running" but no tools appear in chat
In Claude Desktop, the server can show a "running" badge in **Settings → Developer** even when it failed to start or authenticate. The chat gives no error: there's no tools icon, and Claude answers your questions from general knowledge as if the MCP server didn't exist.
**Fixes:**
* Don't trust the badge — verify in a new chat: the tools menu (slider icon) should list **alphacast** with 32 tools, and a test prompt like *"List my Alphacast repositories"* should produce a visible tool call. An answer with no tool call means the server isn't connected.
* Open **Settings → Developer → Open MCP Logs**. The logs are the only reliable way to diagnose this state. Typical causes: `npx` not found (Node.js missing or not on PATH), an invalid `ALPHACAST_API_KEY`, or a malformed config file.
* After fixing, quit Claude Desktop completely from the system tray (closing the window is not enough) and relaunch.
### Tool calls hang or time out
The server calls the Alphacast REST API internally. If those calls fail or hang, tool calls will too.
**Fixes:**
* Confirm network access to `api.alphacast.io` and `www.alphacast.io`: `curl -I https://api.alphacast.io`.
* If you're behind a corporate proxy or VPN, ensure the proxy allows outbound traffic to those domains on port 443.
## Data quirks
### Downloads return a URL instead of rows
CSV downloads return an S3 pre-signed URL as the body instead of streaming the bytes. The MCP server detects this case and follows the URL transparently — but if you are inspecting raw HTTP traffic, you'll see the URL pattern. Nothing to fix; this is expected.
### IDs in errors look like strings
Error messages may show IDs as strings even though the API expects integers. The MCP server coerces strings to integers automatically when calling tools, so passing `"42"` instead of `42` works the same way.
## Where to get help
* For server-side issues, contact Alphacast support with the time of failure and the tool name. Server logs include the request ID.
* For protocol-level questions about MCP itself, see the [official MCP spec](https://modelcontextprotocol.io/).
* For client-specific issues (Claude Code, Codex, etc.), check that client's documentation — the way each client surfaces tool-call errors varies.
# Connect to External Data Providers
Source: https://learn.alphacast.io/providers/overview
Pull series from central banks, statistical agencies, market data sources, and international organizations through a single unified Alphacast API. Browse the live catalog at alphacast.io/explore/apis.
Alphacast connects you to a curated catalog of 30+ external data providers — central banks, national statistics offices, market data sources, and international organizations — through a single unified interface. Every provider follows the same REST conventions: browse, search, preview, then fetch. You do not need to learn each provider's native API.
The authoritative list of providers, their capabilities, popular series, and any API-key requirements lives at **alphacast.io/explore/apis**. That page is always the source of truth — this documentation only describes how to use the API surface.
## Currently supported providers
The catalog is grouped below by provider type. All slugs are case-insensitive — `FRED`, `fred`, and `Fred` resolve to the same provider. Use them in the API paths described later on this page.
### Central banks
| Slug | Provider | API key |
| - | - | - |
| `banrep` | Banco de la República (Colombia) | — |
| `banxico` | Banxico — Banco de México | Required |
| `bcch` | Banco Central de Chile (BDE) | Required |
| `bcra` | BCRA — Banco Central de la República Argentina | — |
| `bcrp` | BCRP — Banco Central de Reserva del Perú | — |
| `boc` | Bank of Canada (Valet) | — |
| `boe` | Bank of England | — |
| `boi` | Bank of Israel | — |
| `ecb` | European Central Bank | — |
| `hkma` | Hong Kong Monetary Authority | — |
| `norges` | Norges Bank | — |
| `taiwan-cbc` | Central Bank of Taiwan (CBC DataAPI) | — |
### National statistics offices
| Slug | Provider | API key |
| - | - | - |
| `abs` | Australian Bureau of Statistics | — |
| `bls` | U.S. Bureau of Labor Statistics | Optional |
| `eurostat` | Eurostat | — |
| `faostat` | FAO FAOSTAT | — |
| `inegi` | INEGI — Instituto Nacional de Estadística y Geografía (Mexico) | Required |
| `insee` | INSEE (France) | — |
| `oecd` | OECD Statistics | — |
| `opendosm` | OpenDOSM (Malaysia) | — |
| `scb` | Statistics Sweden | — |
| `sidra` | IBGE SIDRA (Brazil) | — |
| `ssb` | Statistics Norway | — |
| `unsd` | UN Statistics Division | — |
### Markets and finance
| Slug | Provider | API key |
| - | - | - |
| `a3` | A3 Mercados (Matba/Rofex, Argentina) | — |
| `bcb-opendata` | BCB — Banco Central do Brasil (Open Data) | — |
| `bis` | BIS — Bank for International Settlements | — |
| `coingecko` | CoinGecko | Optional |
| `mae` | MAE — Mercado Abierto Electrónico (Argentina) | — |
### U.S. federal agencies
| Slug | Provider | API key |
| - | - | - |
| `bea` | U.S. Bureau of Economic Analysis | Required |
| `eia` | U.S. Energy Information Administration | Required |
| `fred` | Federal Reserve Economic Data (St. Louis Fed) | Required |
### International organizations
| Slug | Provider | API key |
| - | - | - |
| `ilo` | International Labour Organization | — |
| `imf` | International Monetary Fund | — |
| `unicef` | UNICEF Data Warehouse | — |
| `worldbank` | World Bank Open Data | — |
### Curated and other
| Slug | Provider | API key |
| - | - | - |
| `cepalstat` | CEPALSTAT (ECLAC) | — |
| `owid` | Our World in Data | — |
To see capabilities (`hierarchical`, `search`, `direct`), parameters, and popular series for any provider, call `GET /providers/{slug}` or open it in [the live catalog](https://www.alphacast.io/explore/apis).
## API endpoints
All provider endpoints are available under `https://api.alphacast.io`. Authentication uses your Alphacast API key over HTTP Basic Auth — see the [authentication guide](/authentication).
### List and discover providers
```bash theme={null}
# List all enabled providers with their slugs, capabilities, and license
GET /providers
# Get full detail for a single provider: capabilities, parameters, popular series
GET /providers/{slug}
```
### Browse, search, and fetch series
```bash theme={null}
# Browse hierarchically (topics, categories, surveys)
GET /providers/{slug}/browse?path=
# Full-text search for series within a provider
GET /providers/{slug}/search?q={query}
# Preview the last 24 data points for a series
GET /providers/{slug}/series/{series_id}
# Fetch the full series history
POST /providers/{slug}/series/{series_id}/data
```
### Manage your API keys
```bash theme={null}
# List which providers you have API keys stored for
GET /user-keys
# Save (or update) your API key for a provider
PUT /user-keys/{slug}
```
For providers that require a key (FRED, BLS, INEGI, Banxico, BEA, EIA, BCCH), save your key once using `PUT /user-keys/{slug}`. Alphacast stores it securely and passes it automatically on every subsequent request. You never need to include it in individual calls.
## Capability types
Each provider declares which access patterns it supports.
| Capability | Description |
| - | - |
| `hierarchical` | Browse a tree of topics, categories, or surveys to discover series |
| `search` | Full-text search for series by name or keyword |
| `direct` | Fetch a series directly if you already know its ID |
You can check a provider's capabilities with `GET /providers/{slug}` before deciding how to query it.
## Complete example: list, search, and fetch
The walkthrough below shows the full flow from discovering providers to downloading data.
Retrieve the catalog to see slugs and capabilities.
```bash theme={null}
curl https://api.alphacast.io/providers
```
Each entry in the response includes `slug`, `name`, `capabilities`, and `license`.
Fetch provider detail including its parameters and popular series IDs.
```bash theme={null}
curl https://api.alphacast.io/providers/fred
```
The response includes `popular_series` (a list of well-known series IDs), `parameters` (optional request modifiers), and `browse_root_label`.
Find a series by keyword. Only providers with the `search` capability support this endpoint.
```bash theme={null}
curl "https://api.alphacast.io/providers/fred/search?q=consumer+price+index"
```
Each result contains `series_id` and `label`. Use the `series_id` in the next step.
Retrieve the last 24 data points to confirm you have the right series.
```bash theme={null}
curl https://api.alphacast.io/providers/fred/series/CPIAUCSL
```
The response includes `label`, `metadata` (frequency, units, date range), and a `data` array limited to 24 observations. The `is_preview: true` field indicates this is a truncated response.
Issue a POST to retrieve all historical data. Pass optional parameters in the request body.
```bash Full history theme={null}
curl -X POST https://api.alphacast.io/providers/fred/series/CPIAUCSL/data \
-H "Content-Type: application/json" \
-d '{}'
```
```bash With parameters theme={null}
curl -X POST https://api.alphacast.io/providers/fred/series/CPIAUCSL/data \
-H "Content-Type: application/json" \
-d '{"params": {"units": "pc1", "frequency": "m"}}'
```
The response contains the same structure as the preview but with `is_preview: false` and the full `data` array.
For providers like FRED, BLS, INEGI, or Banxico that enforce rate limits or require authentication, save your key once.
```bash theme={null}
curl -X PUT https://api.alphacast.io/user-keys/fred \
-H "Content-Type: application/json" \
-d '{"api_key": "your_fred_api_key_here"}'
```
After saving, Alphacast uses your key automatically on all subsequent requests to that provider.
Not sure which provider has the data you need? Use the provider match endpoint with a free-text description: `GET /providers/match?q=argentina+exchange+rate`. It returns the top matching providers based on your query.
# Authentication
Source: https://learn.alphacast.io/python-sdk/authentication
How the Alphacast Python SDK authenticates requests with your API key, plus best practices for storing the key safely.
The Alphacast Python SDK authenticates every request with your personal API key. Internally the SDK uses HTTP Basic Auth — your key is sent as the username with an empty password, exactly as documented for the [REST API](/authentication). You only need to provide the key once when you create the client.
Your API key grants full access to your Alphacast account. Do not commit it to source control, share it in chat or screenshots, or embed it in client-side code that ships to users.
## Get your API key
1. Sign in at [alphacast.io](https://www.alphacast.io/api/auth/login).
2. Click your user avatar in the left sidebar to open **Account Settings**.
3. Find or generate your key under the **API Key** section.
Treat the key like a password — anyone holding it can read, upload, and delete data on your behalf.
## Initialize the client
Pass the key to the `Alphacast` constructor. Every method called on the resulting client uses that key:
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
```
The client stores the key in memory and re-uses it for every request. If you need to switch accounts in the same script, instantiate a second client.
## Recommended: read from an environment variable
Hardcoding API keys in your code makes it easy to leak them by accident. Read the key from an environment variable instead:
```python theme={null}
import os
from alphacast import Alphacast
alphacast = Alphacast(os.environ["ALPHACAST_API_KEY"])
```
Set the variable in your shell:
```bash macOS / Linux theme={null}
export ALPHACAST_API_KEY="your-key-here"
```
```powershell Windows (PowerShell) theme={null}
$env:ALPHACAST_API_KEY = "your-key-here"
```
## Loading from a `.env` file
The SDK declares `python-dotenv` as a dependency, so you can keep your key in a local `.env` file:
```
# .env
ALPHACAST_API_KEY=your-key-here
```
```python theme={null}
import os
from dotenv import load_dotenv
from alphacast import Alphacast
load_dotenv()
alphacast = Alphacast(os.environ["ALPHACAST_API_KEY"])
```
Add `.env` to your `.gitignore` so the file is never committed.
## Errors
If the API key is missing or invalid, the SDK raises an `Exception` whose message includes the HTTP status code returned by the server. The most common case is `401`:
```
Exception: API failed with status code 401
```
Common causes:
* The key was mistyped or copied with leading/trailing whitespace.
* The key was revoked or regenerated from the Alphacast UI.
* The key belongs to an account that no longer has access to the requested resource (in which case you may also see `403`).
If you suspect your key has been exposed, regenerate it from your account settings. Regenerating immediately invalidates the old key.
## How the SDK uses your key
Internally, every method in the SDK calls `requests.get`, `requests.post`, `requests.put`, or `requests.delete` with `auth=HTTPBasicAuth(self.api_key, "")`. The Search endpoint is the one exception — it sends the key as an `apiKey` query parameter because the search endpoint lives on the workspace host (`alphacast.io`) rather than on `api.alphacast.io`. Both transports are equivalent in terms of authority — both grant the same access — but Basic Auth is preferred for everything that supports it because the credential travels in the `Authorization` header rather than in the URL.
# Datasets
Source: https://learn.alphacast.io/python-sdk/datasets
List, look up, and inspect datasets with the Alphacast Python SDK — read metadata, columns, and date stats before uploading or downloading.
Datasets are the core unit of data in Alphacast. The SDK exposes them through `alphacast.datasets` (the collection-level client) and `alphacast.datasets.dataset(id)` (a per-dataset handle).
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
alphacast.datasets # collection-level operations
alphacast.datasets.dataset(123) # operations on a specific dataset
```
This page covers **finding** datasets and **inspecting** their metadata. For mutations, see:
* [Uploading data](/python-sdk/uploading) — `create`, `initialize_columns`, `upload_data_from_df`, `upload_data_from_csv`.
* [Downloading data](/python-sdk/downloading) — `download_data` with filters and format options.
* [Process status](/python-sdk/processes) — checking the result of an upload.
## List your datasets
`read_all()` returns every dataset you have access to (owner, admin, or write):
```python theme={null}
datasets = alphacast.datasets.read_all()
for d in datasets:
print(d["id"], d["name"], d["repositoryId"])
```
`read_all()` only returns datasets where your account has owner, admin, or write permission. To pull data from a public dataset you don't directly own, look it up by ID — see [`download_data`](/python-sdk/downloading).
## Look up a dataset by name
```python theme={null}
ds = alphacast.datasets.read_by_name("Quarterly GDP")
if ds:
print("Found:", ds["id"])
```
By default this scans every dataset you can access and returns the first match by name. To disambiguate when the same name exists in multiple repositories, pass `repo_id`:
```python theme={null}
ds = alphacast.datasets.read_by_name("Quarterly GDP", repo_id=42)
```
If no dataset matches, the method returns `None`.
## Per-dataset handle
Most operations on a specific dataset go through `alphacast.datasets.dataset(id)`, which returns a `Dataset` handle bound to that ID:
```python theme={null}
ds = alphacast.datasets.dataset(7938)
```
The handle exposes the methods documented below for inspecting metadata, plus the upload/download/process methods covered on their own pages.
### `metadata()`
Returns the dataset record: `id`, `name`, `description`, `createdAt`, `updatedAt`, `repositoryId`, and your permission level on it.
```python theme={null}
meta = alphacast.datasets.dataset(7938).metadata()
print(meta["name"], meta["repositoryId"], meta["permission"])
```
### `get_column_definitions()`
Returns the list of column definitions stored on the dataset's manifest. Each definition has at least `sourceName` and `dataType`, and entity columns include `isEntity: True`.
```python theme={null}
columns = alphacast.datasets.dataset(7938).get_column_definitions()
for c in columns:
print(c["sourceName"], c.get("dataType"), c.get("isEntity"))
```
Use this to confirm what Alphacast knows about your columns before uploading new data — especially after editing the manifest from the web UI.
### `datestats()`
Returns the inferred frequency and the first/last available dates as raw bytes from the API. Decode and parse the JSON to use the result:
```python theme={null}
import json
raw = alphacast.datasets.dataset(7938).datestats()
stats = json.loads(raw)
print(stats)
# {"frequency": "Q", "minDate": "2010-01-01", "maxDate": "2024-10-01"}
```
This is handy for deciding whether a refresh is needed — compare `maxDate` with the date of the latest publication of the source data.
## Delete a dataset
```python theme={null}
alphacast.datasets.dataset(7938).delete()
```
Deleting a dataset is permanent and removes all uploaded rows. This action cannot be undone.
Returns the raw API response body as bytes.
## Common patterns
### Look up an ID before uploading
If your script bootstraps an environment, find or create the dataset before pushing rows:
```python theme={null}
ds = alphacast.datasets.read_by_name("Quarterly GDP", repo_id=repo_id)
if ds is None:
ds = alphacast.datasets.create("Quarterly GDP", repo_id, returnIdIfExists=True)
dataset_id = ds["id"]
```
### Inspect before downloading
Combine `metadata()`, `get_column_definitions()`, and `datestats()` to understand a dataset before pulling its full payload:
```python theme={null}
handle = alphacast.datasets.dataset(7938)
print(handle.metadata()["name"])
print(handle.get_column_definitions())
print(handle.datestats())
```
For data download options, see [Downloading data](/python-sdk/downloading).
## Next steps
* [Create a dataset and upload data →](/python-sdk/uploading)
* [Download data as DataFrame, CSV, JSON, or XLSX →](/python-sdk/downloading)
* [Check the status of an in-flight upload →](/python-sdk/processes)
# Downloading Data
Source: https://learn.alphacast.io/python-sdk/downloading
Pull dataset rows into your Python code as a pandas DataFrame, CSV, JSON, or XLSX, with optional date, entity, and variable filters.
`download_data()` is the SDK's main read method. Call it on a per-dataset handle to retrieve the dataset's rows in the format of your choice. The method also supports server-side filtering by date range, entity values, and column subset — saving bandwidth and post-processing for large datasets.
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
df = alphacast.datasets.dataset(6755).download_data(format="pandas")
```
You only need read permission on a dataset to download it. For public datasets that you don't own, look the dataset ID up in the URL on [alphacast.io](https://www.alphacast.io) and pass it directly to `dataset()`.
## Output formats
Pass the `format` argument to choose how the data is returned:
| `format` | Returns | Use it when |
| - | - | - |
| `"pandas"` | `pandas.DataFrame` | Working in a notebook or pipeline that consumes DataFrames. |
| `"csv"` | `bytes` (CSV) | Saving to disk or piping into another tool. |
| `"json"` | `list[dict]` | Iterating row-by-row in pure Python. |
| `"xlsx"` | `bytes` (XLSX) | Producing an Excel file for non-technical users. |
| `"tsv"` | `bytes` (TSV) | Tab-separated workflows. |
When `format="json"` the API responds with newline-delimited JSON (NDJSON). The SDK parses it for you and returns a flat list of dicts — one dict per row.
```python theme={null}
# Direct to DataFrame
df = alphacast.datasets.dataset(6755).download_data(format="pandas")
# Raw CSV bytes
csv_bytes = alphacast.datasets.dataset(6755).download_data("csv")
# Save XLSX to disk
xlsx_bytes = alphacast.datasets.dataset(6755).download_data("xlsx")
with open("data.xlsx", "wb") as f:
f.write(xlsx_bytes)
# JSON as a list of dicts
rows = alphacast.datasets.dataset(6755).download_data(format="json")
for row in rows[:5]:
print(row)
```
When `format="pandas"`, the SDK fetches CSV under the hood and parses it with `pandas.read_csv`. You get the same data as `format="csv"`, just already wrapped in a DataFrame.
## Filtering by date range
Pass `startDate` and/or `endDate` as `datetime.date` (or `datetime.datetime`) objects to restrict the rows returned:
```python theme={null}
import datetime as dt
df = alphacast.datasets.dataset(6755).download_data(
format="pandas",
startDate=dt.date(2020, 1, 1),
endDate=dt.date(2024, 12, 31),
)
```
The SDK reads the dataset's column definitions to detect the date column automatically, so you don't need to pass its name. If the dataset has no date column, omit these parameters.
## Filtering by entity values
Use `filterEntities` to restrict rows by the value of one or more entity columns. Pass a dict mapping each entity column to a list of accepted values:
```python theme={null}
df = alphacast.datasets.dataset(6755).download_data(
format="pandas",
filterEntities={"country": ["USA", "Argentina", "Brazil"]},
)
```
You can pass multiple entity columns at once. Each column's values are OR'd internally; the columns are combined with AND:
```python theme={null}
df = alphacast.datasets.dataset(6755).download_data(
format="pandas",
filterEntities={
"country": ["USA", "Mexico"],
"sector": ["Manufacturing", "Services"],
},
)
# country in (USA, Mexico) AND sector in (Manufacturing, Services)
```
## Selecting specific columns
Use `filterVariables` to keep only certain value columns in the output. Entity and date columns are always returned automatically.
```python theme={null}
df = alphacast.datasets.dataset(6755).download_data(
format="pandas",
filterVariables=["GDP_USD_Billions", "Inflation_YoY"],
)
```
Column names must match the names in the dataset schema exactly (case-sensitive). Use [`get_column_definitions()`](/python-sdk/datasets#get-column-definitions) to inspect the available columns first.
## Combining filters
All three filters compose. The example below downloads US and Argentine GDP from 2020 onwards as a DataFrame:
```python theme={null}
import datetime as dt
df = alphacast.datasets.dataset(6755).download_data(
format="pandas",
startDate=dt.date(2020, 1, 1),
filterEntities={"country": ["USA", "Argentina"]},
filterVariables=["GDP_USD_Billions"],
)
```
Filters are applied server-side via OData query parameters, so only the matching rows travel over the network.
## Method signature
```python theme={null}
download_data(
format="csv",
startDate=None,
endDate=None,
filterVariables=[],
filterEntities=[],
)
```
One of `"csv"`, `"json"`, `"xlsx"`, `"tsv"`, or `"pandas"`. The first four return the raw bytes (or list of dicts for JSON); `"pandas"` returns a DataFrame.
Inclusive lower bound for the date column. The SDK detects the date column automatically.
Inclusive upper bound for the date column.
Column names to include. Entity and date columns are always included even if not listed.
Mapping of entity column name to accepted values. Multiple keys are AND'd; values within a key are OR'd.
## Public datasets
You can download from any public dataset on Alphacast — even ones you don't own — by passing its ID. Find the ID in the URL on [alphacast.io](https://www.alphacast.io) (e.g. `/datasets/5208/...` → ID `5208`).
```python theme={null}
df = alphacast.datasets.dataset(5208).download_data(format="pandas")
```
## Next steps
* Discover dataset IDs across the catalog with [Search](/python-sdk/search).
* Read [`download_data` REST reference](/api/datasets/data) for the underlying OData parameters.
# Alphacast Python SDK
Source: https://learn.alphacast.io/python-sdk/overview
Install the Alphacast Python SDK and interact with repositories, datasets, series, and search from your Python code — no need to call the REST API directly.
The **Alphacast Python SDK** is the official Python client for the Alphacast API. It wraps the REST endpoints in a small set of Python classes so you can manage repositories, upload and download datasets, query individual series, and search for content without writing HTTP code by hand.
The SDK is designed for the most common workflows of Alphacast users:
* **Pulling data into a notebook** — return any dataset directly as a `pandas.DataFrame`.
* **Pushing your own data** — upload a `DataFrame` or CSV with one method call.
* **Automating data pipelines** — create repositories, initialize columns, and check process status programmatically.
* **Discovery** — search datasets across your repositories or the entire public catalog.
The SDK is open source and published on PyPI as [`alphacast`](https://pypi.org/project/alphacast/). Source code, issues, and releases live at [github.com/Alphacastio/alphacast-python-sdk](https://github.com/Alphacastio/alphacast-python-sdk).
## Installation
Install the package from PyPI:
```bash theme={null}
pip install alphacast
```
The SDK targets Python 3.6+ and depends on `requests`, `pandas`, and `python-dotenv`. These are installed automatically.
## Initialize the client
Import the `Alphacast` class and instantiate it with your API key. You can find your key in your [account settings](https://www.alphacast.io/api/auth/login) under **Account Settings → API Key**.
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
```
The constructor returns a single client object that exposes four sub-clients — one per resource type:
| Attribute | Class | Description |
| - | - | - |
| `alphacast.repository` | `Repository` | Create, list, and delete repositories. |
| `alphacast.datasets` | `Datasets` | List, create, upload, download, and delete datasets. |
| `alphacast.search` | `Search` | Full-text search for datasets across the catalog. |
| `alphacast.series(id)` | `Series` | Read metadata and data for a single series. |
Avoid hardcoding your API key. Read it from an environment variable instead:
```python theme={null}
import os
from alphacast import Alphacast
alphacast = Alphacast(os.environ["ALPHACAST_API_KEY"])
```
The SDK also imports `python-dotenv` as a dependency — load a `.env` file with `from dotenv import load_dotenv; load_dotenv()` before reading the variable.
## What's in this section
End-to-end example: install, create a repository, upload a CSV, and download it as a DataFrame.
Where to find your API key and how the SDK uses it.
`repository.read_all`, `read_by_id`, `read_by_name`, `create`, `delete`.
Find datasets by name or ID and inspect their metadata, columns, and date stats.
Create a dataset, initialize its columns, and upload from a DataFrame or CSV.
Pull data as JSON, CSV, XLSX, or directly into a `pandas.DataFrame`.
Read metadata and data for individual series by ID.
Search datasets across your repositories and Alphacast's public catalog.
## Beyond the SDK
The SDK does not currently cover every endpoint exposed by the REST API (data providers, MCP, account management). For workflows that fall outside the SDK's surface, fall back to the [REST API reference](/api/overview) and call the API with `requests` directly using your same API key.
# Process Status
Source: https://learn.alphacast.io/python-sdk/processes
Poll the status of an upload process from the Alphacast Python SDK to know when your data is ready.
When you upload data with `upload_data_from_df` or `upload_data_from_csv`, the call returns immediately with a **process** record. The actual merge runs in the background. Use the methods below to check progress and inspect the result.
For the full upload lifecycle (states, idempotency, notifications) see [Upload lifecycle](/uploading/overview#the-upload-lifecycle) in the Documentation tab.
## List all processes for a dataset
`processes()` returns every upload process recorded for the dataset, most recent first. The response is the raw API body as bytes — decode and parse it as JSON:
```python theme={null}
import json
raw = alphacast.datasets.dataset(7938).processes()
processes = json.loads(raw)
for p in processes[:5]:
print(p["id"], p["status"], p.get("statusDescription"))
```
Each entry includes at least:
| Field | Meaning |
| - | - |
| `id` | Process ID. |
| `datasetId` | The dataset this process belongs to. |
| `status` | `Requested`, `Processing`, `Processed`, or `Error`. |
| `statusDescription` | Free-text summary (e.g., `1292 values added to database.`). |
| `deleteMissingFromDB` | The flag value used for this upload. |
| `onConflictUpdateDB` | The flag value used for this upload. |
| `createdAt` | When the upload was submitted. |
| `processedAt` | When processing finished. |
## Get a single process
If you saved the process ID returned by the upload call, fetch only that record with `process(id)`:
```python theme={null}
import json
raw = alphacast.datasets.dataset(7938).process(45141)
record = json.loads(raw)
print(record["status"], record.get("statusDescription"))
```
The response shape matches a single entry from `processes()`.
## Polling pattern
To wait for an upload to complete, poll until the status leaves `Requested`/`Processing`:
```python theme={null}
import json
import time
dataset_id = 7938
upload = alphacast.datasets.dataset(dataset_id).upload_data_from_df(df)
process_id = json.loads(upload)["id"]
while True:
raw = alphacast.datasets.dataset(dataset_id).process(process_id)
record = json.loads(raw)
status = record["status"]
if status in ("Processed", "Error"):
break
time.sleep(5)
if status == "Error":
raise RuntimeError(f"Upload failed: {record.get('statusDescription')}")
print("Upload complete:", record.get("statusDescription"))
```
Most uploads finish in seconds. For large CSVs (hundreds of MB) processing can take several minutes — only one process per dataset runs at a time, so subsequent uploads wait in `Requested` until the in-flight job finishes.
## Upload stats
After a successful run, the process record's `stats` field contains row-level counts: `insertedValues`, `updatedValues`, `deletedValues`, `changedValues`, `totalValues`, `minDate`, `maxDate`. Use these for logging or to drive your own monitoring:
```python theme={null}
record = json.loads(alphacast.datasets.dataset(7938).process(45141))
stats = record.get("stats", {})
print("Inserted:", stats.get("insertedValues"))
print("Updated:", stats.get("updatedValues"))
print("Deleted:", stats.get("deletedValues"))
```
## Error handling
When the worker rejects the upload — duplicated rows, manifest mismatch, missing date column — the process transitions to `Error` and `statusDescription` carries the message. The full list of validation rules is documented in [Validation rules](/uploading/validation#validation-rules).
```python theme={null}
record = json.loads(alphacast.datasets.dataset(7938).process(45141))
if record["status"] == "Error":
print("Upload failed:", record["statusDescription"])
```
## Next steps
* Trigger a new upload — see [Uploading data](/python-sdk/uploading).
* Read the dataset back once processing finishes — see [Downloading data](/python-sdk/downloading).
# Python SDK Quickstart
Source: https://learn.alphacast.io/python-sdk/quickstart
Install the Alphacast Python SDK, create a repository, upload a pandas DataFrame, and download it back — in under five minutes.
This guide walks through the full Alphacast workflow using the Python SDK: install, authenticate, create a repository, create a dataset, initialize its columns, upload a `pandas.DataFrame`, and download the data back. By the end you will have a working dataset on Alphacast and a script you can adapt to your own data.
All examples use HTTP Basic Auth via the `Alphacast` client. See the [authentication page](/python-sdk/authentication) for details on how the SDK passes your API key to every request.
Install `alphacast` from PyPI. Pandas is pulled in as a dependency.
```bash theme={null}
pip install alphacast
```
Get your API key from your [account settings](https://www.alphacast.io/api/auth/login) and pass it to the `Alphacast` constructor:
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
```
Store the key in an environment variable rather than hardcoding it. See the [authentication page](/python-sdk/authentication) for the recommended pattern.
Repositories are top-level containers that hold datasets. Create one with `repository.create`:
```python theme={null}
repo = alphacast.repository.create(
"My First Repo",
repo_description="Sandbox for the SDK quickstart",
slug="my-first-repo",
privacy="Private",
returnIdIfExists=True,
)
repo_id = repo["id"]
```
Setting `returnIdIfExists=True` makes the call idempotent — if a repository with that name already exists, the existing one is returned instead of raising.
Datasets live inside a repository. Provide a name, the parent `repo_id`, and an optional description:
```python theme={null}
dataset = alphacast.datasets.create(
"Quarterly GDP",
repo_id,
description="GDP series by country",
returnIdIfExists=True,
)
dataset_id = dataset["id"]
```
The dataset is empty until you upload data. The next two steps configure its columns and push your first batch of rows.
Before uploading you must declare which column carries the date and which columns identify a row (the **entity** columns). Together, the date and the entity columns form a unique key — every `(Date, Entity)` pair must be unique in the file.
```python theme={null}
alphacast.datasets.dataset(dataset_id).initialize_columns(
dateColumnName="Date",
entitiesColumnNames=["country"],
dateFormat="%Y-%m-%d",
)
```
Alphacast's chart engine currently expects a single entity column. Multiple entity columns are supported for storage and download, but not for in-platform charting.
Build a `DataFrame` with at least your date column, your entity column, and one or more value columns. Then call `upload_data_from_df`:
```python theme={null}
import pandas as pd
df = pd.DataFrame({
"Date": ["2023-01-01", "2023-04-01", "2023-07-01"],
"country": ["USA", "USA", "USA"],
"GDP_USD_Billions": [6823.4, 6901.2, 6987.6],
})
raw = alphacast.datasets.dataset(dataset_id).upload_data_from_df(
df,
deleteMissingFromDB=False,
onConflictUpdateDB=True,
uploadIndex=False,
)
process = json.loads(raw)
print(process["id"], process["status"])
```
Uploads are processed asynchronously. The call returns the response body as bytes; decode it with `json.loads` to get the process record. Use `dataset(id).processes()` or `dataset(id).process(process_id)` to poll status — see [Process status](/python-sdk/processes).
Once the process finishes, download the data. Pass `format="pandas"` to get a ready-to-use `DataFrame`:
```python theme={null}
df = alphacast.datasets.dataset(dataset_id).download_data(format="pandas")
print(df.head())
```
Other supported formats: `"csv"`, `"json"`, `"xlsx"`, `"tsv"`. See [Downloading data](/python-sdk/downloading) for filtering by date, country, or column.
## End-to-end script
Here is the full quickstart in a single file you can run as `python quickstart.py`:
```python theme={null}
import os
import pandas as pd
from alphacast import Alphacast
alphacast = Alphacast(os.environ["ALPHACAST_API_KEY"])
repo = alphacast.repository.create(
"My First Repo",
repo_description="Sandbox for the SDK quickstart",
privacy="Private",
returnIdIfExists=True,
)
repo_id = repo["id"]
dataset = alphacast.datasets.create(
"Quarterly GDP",
repo_id,
description="GDP series by country",
returnIdIfExists=True,
)
dataset_id = dataset["id"]
alphacast.datasets.dataset(dataset_id).initialize_columns(
dateColumnName="Date",
entitiesColumnNames=["country"],
dateFormat="%Y-%m-%d",
)
df = pd.DataFrame({
"Date": ["2023-01-01", "2023-04-01", "2023-07-01"],
"country": ["USA", "USA", "USA"],
"GDP_USD_Billions": [6823.4, 6901.2, 6987.6],
})
alphacast.datasets.dataset(dataset_id).upload_data_from_df(
df,
deleteMissingFromDB=False,
onConflictUpdateDB=True,
uploadIndex=False,
)
# Re-download once the upload has been processed
result = alphacast.datasets.dataset(dataset_id).download_data(format="pandas")
print(result.head())
```
## Next steps
* Learn the full surface of the [Datasets class](/python-sdk/datasets) — finding by name, listing, inspecting columns and date stats.
* Combine multiple flags when uploading — see [Uploading data](/python-sdk/uploading).
* Use [Search](/python-sdk/search) to find existing datasets you can pull instead of building your own.
# API Reference
Source: https://learn.alphacast.io/python-sdk/reference
Method-by-method reference of the Alphacast Python SDK — every public class, method, and parameter.
A flat, scannable reference for everything in `alphacast`. Every method is documented in detail on its own page; this page is for quick lookup.
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
```
## `Alphacast(api_key)`
The top-level client. Holds your API key and exposes the four sub-clients.
| Attribute | Type | Description |
| - | - | - |
| `repository` | `Repository` | [Repository operations](/python-sdk/repositories). |
| `datasets` | `Datasets` | [Dataset listing and creation](/python-sdk/datasets). |
| `search` | `Search` | [Catalog search](/python-sdk/search). |
| `series(series_id)` | `Series` | [Series handle](/python-sdk/series). Returns a fresh `Series` each call. |
## `Repository`
Documented on the [Repositories](/python-sdk/repositories) page.
| Method | Returns | Description |
| - | - | - |
| `read_all()` | `list[dict]` | Every repository visible to your API key. |
| `read_by_id(repository_id)` | `dict` | One repository by numeric ID. |
| `read_by_name(repo_name)` | `dict \| False` | First repository whose `name` matches exactly. Returns `False` when not found. |
| `create(repo_name, repo_description=None, privacy="Private", slug=None, returnIdIfExists=False)` | `dict` | Create a new repository. |
| `delete(repository_id)` | `bytes` | Delete a repository **and all its datasets**. |
## `Datasets`
Documented on the [Datasets](/python-sdk/datasets) page (collection-level methods) and [Uploading data](/python-sdk/uploading) (`create`).
| Method | Returns | Description |
| - | - | - |
| `read_all()` | `list[dict]` | Every dataset where you have owner / admin / write permission. |
| `read_by_name(dataset_name, repo_id=None)` | `dict \| None` | First dataset whose name matches. Pass `repo_id` to disambiguate. |
| `create(dataset_name, repo_id, description="", returnIdIfExists=False)` | `dict` | Create an empty dataset in a repository. |
| `dataset(dataset_id)` | `Dataset` | Per-dataset handle (see below). |
## `Dataset` (per-dataset handle)
Returned by `alphacast.datasets.dataset(id)`. Each call constructs a fresh handle bound to the given ID.
### Read methods
| Method | Returns | Documented at |
| - | - | - |
| `metadata()` | `dict` | [datasets.mdx](/python-sdk/datasets#metadata) |
| `get_column_definitions()` | `list[dict]` | [datasets.mdx](/python-sdk/datasets#get-column-definitions) |
| `datestats()` | `bytes` | [datasets.mdx](/python-sdk/datasets#datestats) |
| `download_data(format="csv", startDate=None, endDate=None, filterVariables=[], filterEntities=[])` | depends on `format` | [downloading.mdx](/python-sdk/downloading) |
### Write methods
| Method | Returns | Documented at |
| - | - | - |
| `initialize_columns(dateColumnName, entitiesColumnNames, dateFormat)` | `bytes` | [uploading.mdx](/python-sdk/uploading#2-initialize-the-columns) |
| `upload_data_from_df(df, deleteMissingFromDB=False, onConflictUpdateDB=False, uploadIndex=True, dateColumnName=None, dateFormat=None, entitiesColumnNames=None, stringColumnNames=None, acceptNewColumns=None)` | `bytes` | [uploading.mdx](/python-sdk/uploading#from-a-pandas-dataframe) |
| `upload_data_from_csv(csv, deleteMissingFromDB=False, onConflictUpdateDB=False, dateColumnName=None, dateFormat=None, entitiesColumnNames=None, stringColumnNames=None, acceptNewColumns=None)` | `bytes` | [uploading.mdx](/python-sdk/uploading#from-a-csv-string) |
| `delete()` | `bytes` | [datasets.mdx](/python-sdk/datasets#delete-a-dataset) |
### Process
| Method | Returns | Documented at |
| - | - | - |
| `processes()` | `bytes` | [processes.mdx](/python-sdk/processes#list-all-processes-for-a-dataset) |
| `process(process_id)` | `bytes` | [processes.mdx](/python-sdk/processes#get-a-single-process) |
## `Search`
Documented on the [Search](/python-sdk/search) page.
| Method | Returns | Description |
| - | - | - |
| `datasets(query, offset=0, length=10, repository_id=None, search_all=False, exclude_deprecated=False)` | `dict` | Full-text search. Returns `{data, totalItems, totalPages, currentPage, offset}`. |
## `Series`
Documented on the [Series](/python-sdk/series) page.
| Method | Returns | Description |
| - | - | - |
| `metadata()` | `dict` | Series metadata — name, units, frequency, parent dataset. |
| `download_data(format="csv")` | depends on `format` | Series values. Same `format` options as `Dataset.download_data`. |
## Conventions
* **Mutating methods return `bytes`.** The SDK returns the raw API response body for `initialize_columns`, `upload_data_from_*`, `delete`, `processes`, `process`, and `get_connector_run`. Decode and `json.loads(...)` if you need a dict.
* **Read methods return parsed JSON.** `read_all`, `read_by_id`, `metadata`, `get_column_definitions`, and `search.datasets` return Python dicts/lists directly.
* **`download_data` is special.** Its return type depends on `format`: bytes for CSV/XLSX/TSV, list of dicts for JSON, `pandas.DataFrame` for `pandas`.
* **All methods raise `Exception`** on HTTP errors (status not OK). The message includes the status code and any server-provided error message.
## Source
The SDK is open source. Full source: [github.com/Alphacastio/alphacast-python-sdk/blob/main/alphacast/alphacast.py](https://github.com/Alphacastio/alphacast-python-sdk/blob/main/alphacast/alphacast.py).
# Repositories
Source: https://learn.alphacast.io/python-sdk/repositories
Use the Alphacast Python SDK's repository client to list, look up, create, and delete repositories — the top-level containers for your datasets.
Every dataset in Alphacast lives inside a **repository**. Repositories control privacy (Public vs Private) and grant permissions to users. The SDK exposes repository operations through the `repository` attribute on the `Alphacast` client.
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
alphacast.repository # the repository client
```
For the conceptual overview of what a repository is and how permissions work, see [Repositories](/concepts/repositories) in the Documentation tab.
## List your repositories
`read_all()` returns every repository where you have at least read permission, including public repositories you have explicitly subscribed to.
```python theme={null}
repos = alphacast.repository.read_all()
for repo in repos:
print(repo["id"], repo["name"], repo["privacy"])
```
The response is a list of dicts. Each dict includes at least `id`, `name`, `description`, `privacy`, `slug`, and `permission`.
## Look up a repository by ID
```python theme={null}
repo = alphacast.repository.read_by_id(42)
print(repo["name"])
```
Use this when you already have the repository ID — for example from a previous `create()` call or from the URL `https://www.alphacast.io/repositories/{id}` in the Alphacast UI.
## Look up a repository by name
```python theme={null}
repo = alphacast.repository.read_by_name("My First Repo")
if repo:
print("Found:", repo["id"])
else:
print("Not found")
```
`read_by_name` scans the list returned by `read_all()` and returns the first repository whose `name` matches exactly. If no repository matches, it returns `False`.
Name lookup is case-sensitive and matches the exact string. If you have repositories with similar names, prefer looking them up by ID.
## Create a repository
```python theme={null}
repo = alphacast.repository.create(
"Macro Indicators",
repo_description="A repository for macroeconomic indicators",
privacy="Private",
slug="macro-indicators",
returnIdIfExists=True,
)
print(repo["id"])
```
### Parameters
Display name for the repository. Must be unique within your account.
Long-form description shown on the repository page. Defaults to `repo_name` if omitted.
`"Private"` or `"Public"`. Public repositories are discoverable by all Alphacast users.
URL-safe identifier used in the repository's web URL. Defaults to a slugified version of `repo_name` if omitted.
Controls behavior when a repository with the same `repo_name` already exists. When `True`, the existing repository is returned. When `False`, a `ValueError` is raised.
### Idempotent create
Pass `returnIdIfExists=True` to make repository creation safe to re-run — for example in a script that bootstraps an environment:
```python theme={null}
repo = alphacast.repository.create(
"Sandbox",
privacy="Private",
returnIdIfExists=True,
)
repo_id = repo["id"]
```
The first run creates the repository; subsequent runs return the existing one without raising.
## Delete a repository
```python theme={null}
alphacast.repository.delete(42)
```
Deleting a repository permanently removes the repository **and every dataset inside it**, including all uploaded data. This action cannot be undone.
Pass the repository's numeric ID. The call returns the raw response body from the API as bytes — the SDK does not parse it.
## Common patterns
### Find or create
When you want a single canonical repository for a workflow:
```python theme={null}
repo = (
alphacast.repository.read_by_name("Macro Indicators")
or alphacast.repository.create("Macro Indicators", privacy="Private")
)
repo_id = repo["id"]
```
Or, equivalently, with `returnIdIfExists`:
```python theme={null}
repo = alphacast.repository.create(
"Macro Indicators",
privacy="Private",
returnIdIfExists=True,
)
```
### List only repositories you can write to
`read_all()` returns repositories where you have *any* permission. Filter on the `permission` field to keep only writeable ones:
```python theme={null}
writable = [
r for r in alphacast.repository.read_all()
if r["permission"] in ("Owner", "Admin", "Write")
]
```
## Next steps
* Add datasets to a repository — see [Datasets](/python-sdk/datasets).
* Push data into a dataset — see [Uploading data](/python-sdk/uploading).
# Search
Source: https://learn.alphacast.io/python-sdk/search
Find datasets across your repositories and Alphacast's public catalog using the Python SDK's search client.
`alphacast.search.datasets()` runs a full-text search against Alphacast's catalog. By default it scopes to datasets your account has read access to (your own repositories plus anything you've been granted access to). Pass `search_all=True` to extend the search to every public dataset on Alphacast.
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
results = alphacast.search.datasets("GDP Argentina")
for ds in results["data"]:
print(ds["id"], ds["name"])
```
## Method signature
```python theme={null}
search.datasets(
query,
offset=0,
length=10,
repository_id=None,
search_all=False,
exclude_deprecated=False,
)
```
Free-text search. Supports fuzzy matching, so close spellings still rank.
Number of results to skip. Use with `length` for pagination.
Maximum number of results to return.
Restrict results to a single repository.
When `True`, search every public dataset on Alphacast. When `False`, search only datasets your account can already read.
When `True`, omit datasets flagged as deprecated.
## Response shape
The method returns a dict:
```python theme={null}
{
"data": [...], # list of matching datasets
"totalItems": 124, # total matches across all pages
"totalPages": 13,
"currentPage": 1,
"offset": 0,
}
```
Each entry in `data` includes the dataset's `id`, `name`, `description`, source metadata, and other fields the search service returns. Use the `id` to feed `dataset(id)` for further reads.
## Examples
### Paginate through results
```python theme={null}
page1 = alphacast.search.datasets("inflation", offset=0, length=10)
page2 = alphacast.search.datasets("inflation", offset=10, length=10)
print(f"Showing {len(page1['data'])} of {page1['totalItems']} results")
```
### Search the entire public catalog
```python theme={null}
results = alphacast.search.datasets("CPI", search_all=True)
```
Useful when you want to discover datasets you don't already have access to. Public results can be downloaded directly with `dataset(id).download_data(...)`.
### Filter by repository
```python theme={null}
results = alphacast.search.datasets("employment", repository_id=42)
```
### Exclude deprecated datasets
```python theme={null}
results = alphacast.search.datasets("GDP", exclude_deprecated=True)
```
## Search results → download
A common pattern is to search, pick a result, and pull the data:
```python theme={null}
results = alphacast.search.datasets("Argentina inflation", search_all=True, length=5)
# Take the top hit
top = results["data"][0]
print("Selected:", top["id"], top["name"])
df = alphacast.datasets.dataset(top["id"]).download_data(format="pandas")
```
## Notes on the underlying endpoint
`search.datasets()` calls the Alphacast workspace search endpoint at `https://www.alphacast.io/api/search`, not the standard REST API on `api.alphacast.io`. The SDK passes your API key as an `apiKey` query parameter on this endpoint — the search service does not currently support HTTP Basic Auth. Permissions are still respected: you only see what your key is authorized to read, plus any public content if `search_all=True`.
## Next steps
* Pull a dataset by ID — see [Downloading data](/python-sdk/downloading).
* Programmatically discover what's in a repository — see [Datasets](/python-sdk/datasets).
# Series
Source: https://learn.alphacast.io/python-sdk/series
Read metadata and data for a single Alphacast series by ID using the Python SDK.
A **series** is a single time-indexed variable inside a dataset — for example, the headline CPI of a single country. Series are addressable by ID across all of Alphacast, so you can pull them directly without going through their parent dataset.
The SDK exposes series via `alphacast.series(series_id)`, which returns a `Series` handle.
```python theme={null}
from alphacast import Alphacast
alphacast = Alphacast("YOUR_API_KEY")
series = alphacast.series(12345)
```
You need read permission on the parent dataset to read a series. Find a series ID in the URL on [alphacast.io](https://www.alphacast.io) when viewing an individual variable.
## Read metadata
```python theme={null}
meta = alphacast.series(12345).metadata()
print(meta)
```
Returns a dict describing the series — its name, dataset ID, units, frequency, and other metadata fields exposed by the REST API.
## Download the data
Like datasets, series support the same five output formats:
```python theme={null}
# pandas
df = alphacast.series(12345).download_data(format="pandas")
# csv bytes
csv_bytes = alphacast.series(12345).download_data("csv")
# json (list of dicts)
rows = alphacast.series(12345).download_data(format="json")
# xlsx / tsv bytes
xlsx_bytes = alphacast.series(12345).download_data("xlsx")
tsv_bytes = alphacast.series(12345).download_data("tsv")
```
When `format="pandas"`, the SDK fetches CSV under the hood and returns a parsed `DataFrame`. When `format="json"`, the SDK parses newline-delimited JSON and returns a list of dicts.
The Series download endpoint does not currently expose date-range or column filters. If you need filtered reads, fetch from the parent dataset with [`download_data`](/python-sdk/downloading) instead.
## Method signature
```python theme={null}
class Series:
def metadata(self) -> dict: ...
def download_data(self, format: str = "csv"): ...
```
One of `"csv"`, `"json"`, `"xlsx"`, `"tsv"`, or `"pandas"`. The first four return raw bytes (or list of dicts for JSON); `"pandas"` returns a DataFrame.
## When to use series vs datasets
* **Series** — ideal when you only need a single variable, and you already know its series ID. Lighter payload, single-column DataFrame.
* **Dataset** — ideal when you need multiple variables together, want to filter by entity or date, or want to manage uploads. Use [`download_data`](/python-sdk/downloading) on the dataset handle.
## Next steps
* Find dataset and series content with [Search](/python-sdk/search).
* Combine multiple variables in a single download via [Downloading data](/python-sdk/downloading).
# Uploading Data
Source: https://learn.alphacast.io/python-sdk/uploading
Create datasets, declare their column schema, and upload pandas DataFrames or CSV strings to Alphacast using the Python SDK.
The SDK turns the three-step Alphacast upload workflow — create dataset, initialize columns, upload data — into three short Python calls. This page walks through each step and the conflict-resolution flags that control how new data is merged with existing rows.
The mechanics of validation, manifests, and the merge logic are documented in the [Uploading Data](/uploading/overview) section. This page focuses on the SDK surface; refer back to the concept pages when you need to understand *why* an upload behaved a certain way.
## 1. Create the dataset
`datasets.create()` registers a new empty dataset inside a repository:
```python theme={null}
ds = alphacast.datasets.create(
"Quarterly GDP",
repo_id=42,
description="GDP series by country",
returnIdIfExists=True,
)
dataset_id = ds["id"]
```
### Parameters
Display name. Must be unique within the parent repository.
Numeric ID of the parent repository.
Long-form description shown on the dataset page.
When `True`, an existing dataset with the same name in the same repo is returned instead of raising. Use this for idempotent setup scripts.
If the dataset already exists and `returnIdIfExists=False`, the call raises `ValueError`. The error message includes the existing dataset's ID.
## 2. Initialize the columns
Before the first upload, declare which column carries the date and which columns identify a row. You can do this in either of two ways:
1. **Call `initialize_columns()` before uploading** — sets the manifest as a separate API call (covered in this section).
2. **Pass the manifest fields directly to the upload call** — `upload_data_from_df` and `upload_data_from_csv` accept the same parameters and build the manifest in-flight (covered in [Inline schema declaration](#inline-schema-declaration) below). This is what the SDK's own tests use.
Both approaches set the same underlying manifest. Pick whichever fits your code.
### `initialize_columns()`
Use `initialize_columns()` on the dataset handle:
```python theme={null}
alphacast.datasets.dataset(dataset_id).initialize_columns(
dateColumnName="Date",
entitiesColumnNames=["country"],
dateFormat="%Y-%m-%d",
)
```
Name of the date column in your CSV / DataFrame. Must match exactly (case-sensitive).
Names of the entity columns. Together with the date column they form the dataset's unique key — every `(date, entity values...)` combination must be unique.
`strftime` format string describing how dates are written in the CSV — for example `"%Y-%m-%d"` for ISO dates or `"%d/%m/%Y"` for European-style.
Alphacast's chart engine currently expects a single entity column. Multiple entities are supported for storage and download, but charting works only on single-entity datasets.
## 3. Upload the data
The SDK provides two upload methods. Both upload to the same endpoint and accept the same merge flags — the only difference is the input type.
### From a `pandas.DataFrame`
```python theme={null}
process = alphacast.datasets.dataset(dataset_id).upload_data_from_df(
df,
deleteMissingFromDB=False,
onConflictUpdateDB=True,
uploadIndex=False,
)
```
The SDK serializes the DataFrame to CSV in memory, gzip-compresses it, and `PUT`s it to `/datasets/{id}/data`. The call returns the API's raw response — the JSON of an upload **process** record.
The data to upload. Must contain the date column and every entity column declared in `initialize_columns`. Raises if the DataFrame is empty.
Whether to include the DataFrame's index column in the upload. Set to `False` if your DataFrame has a meaningless `RangeIndex`.
### From a CSV string
```python theme={null}
csv_text = open("gdp.csv").read()
process = alphacast.datasets.dataset(dataset_id).upload_data_from_csv(
csv_text,
deleteMissingFromDB=False,
onConflictUpdateDB=True,
)
```
`upload_data_from_csv` accepts the CSV as a Python string. The SDK gzip-compresses it before uploading.
## Merge flags
Both upload methods accept the same conflict-resolution flags:
When `True`, rows already in the dataset that are absent from the upload are **deleted**. Use for full replacements.
When `True`, rows whose key matches an existing row are **updated** with the incoming value. When `False`, the existing value is kept.
When `True`, columns in the CSV that aren't in the existing schema are **added** to the dataset. When `False` (or omitted), unknown columns cause the upload to fail.
The same flags map directly to the [REST API query parameters](/api/datasets/upload). The full validation logic and edge cases are described in [Validation & upload modes](/uploading/validation).
### Common combinations
| Goal | `deleteMissingFromDB` | `onConflictUpdateDB` |
| - | - | - |
| Append new rows, never overwrite existing | `False` | `False` |
| Append new rows, overwrite duplicates | `False` | `True` |
| Full replacement (mirror the upload exactly) | `True` | `True` |
| Trim the dataset to match the upload, but keep existing values where they overlap | `True` | `False` |
## Inline schema declaration
Both upload methods can declare the column schema inline — useful when you want to push data and set the manifest in a single call. Pass the same field names as `initialize_columns`, plus optional `stringColumnNames` and `acceptNewColumns`:
```python theme={null}
alphacast.datasets.dataset(dataset_id).upload_data_from_df(
df,
deleteMissingFromDB=False,
onConflictUpdateDB=True,
uploadIndex=False,
dateColumnName="Date",
dateFormat="%Y-%m-%d",
entitiesColumnNames=["country"],
stringColumnNames=["notes"],
acceptNewColumns=True,
)
```
When provided, these arguments are sent as the upload's `manifest` form field — see the [manifest reference](/uploading/manifest). With this pattern you can skip the separate `initialize_columns()` call entirely.
Use `acceptNewColumns=True` together with the inline manifest to **add new columns** to an existing dataset on the next upload. Without it, columns not already in the schema cause the upload to fail.
## Return value
Both `upload_data_from_df` and `upload_data_from_csv` return the API response body as **bytes** — a JSON-encoded process record. Decode with `json.loads(...)` to use it:
```python theme={null}
import json
raw = alphacast.datasets.dataset(dataset_id).upload_data_from_df(df)
process = json.loads(raw)
print(process["id"], process["status"])
# {"id": 45141, "status": "Requested", "createdAt": "2026-04-28T16:58:18.999786", "datasetId": 7938}
```
The process moves through `Requested → Processing → Processed` (or `Error`). To poll for completion, see [Process status](/python-sdk/processes).
## End-to-end example
```python theme={null}
import os
import pandas as pd
from alphacast import Alphacast
alphacast = Alphacast(os.environ["ALPHACAST_API_KEY"])
# 1. Repository
repo = alphacast.repository.create(
"Macro Indicators", privacy="Private", returnIdIfExists=True
)
# 2. Dataset
ds = alphacast.datasets.create(
"Quarterly GDP", repo["id"], returnIdIfExists=True
)
dataset_id = ds["id"]
# 3. Columns
alphacast.datasets.dataset(dataset_id).initialize_columns(
dateColumnName="Date",
entitiesColumnNames=["country"],
dateFormat="%Y-%m-%d",
)
# 4. Data
df = pd.read_csv("gdp.csv")
alphacast.datasets.dataset(dataset_id).upload_data_from_df(
df,
deleteMissingFromDB=False,
onConflictUpdateDB=True,
uploadIndex=False,
)
```
## Next steps
* Verify the upload succeeded — see [Process status](/python-sdk/processes).
* Pull the data back as a DataFrame — see [Downloading data](/python-sdk/downloading).
* Read the [validation rules](/uploading/validation) to understand why an upload might end up in `Error` state.
# Get Started with Alphacast API
Source: https://learn.alphacast.io/quickstart
Get your API key, create a repository and dataset, upload data, and download it — all in under five minutes using the Alphacast API.
This guide walks you through the core workflow of the Alphacast API: creating a repository to hold your data, adding a dataset to it, uploading a file, and retrieving that data in the format of your choice. All examples use `curl` and the base URL `https://api.alphacast.io`.
All requests require an API key. See the [authentication guide](/authentication) for details on how to obtain and use your key.
Log in to [alphacast.io](https://alphacast.io) and navigate to your account settings to generate an API key. You will use this key to authenticate every request.
Alphacast uses HTTP Basic Auth, where the API key is passed as the username with an empty password. The `-u` flag in `curl` handles this automatically:
```bash theme={null}
curl https://api.alphacast.io/repositories \
-u YOUR_API_KEY:
```
The trailing colon after your API key tells `curl` to send an empty password, which is required by HTTP Basic Auth.
Repositories are the top-level containers that organize your datasets. Every dataset must belong to a repository. Create one by sending a `POST` request to `/repositories`:
```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",
"description": "A repository for testing the Alphacast API",
"privacy": "Private"
}'
```
The `privacy` field accepts `"Private"` or `"Public"`. A successful response returns `201` with the new repository object:
```json theme={null}
{
"id": 42,
"name": "My First Repository",
"description": "A repository for testing the Alphacast API",
"privacy": "Private",
"permission": "Owner"
}
```
Note the `id` — you will need it in the next step.
Within your repository, create a dataset by posting to `/datasets`. The `repositoryId` field must match the repository you created above:
```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,
"description": "GDP data by quarter",
"sourceName": "National Statistics Office",
"sourceUrl": "https://example.com/gdp-data"
}'
```
A successful response returns `201` with the dataset object:
```json theme={null}
{
"id": 101,
"name": "Quarterly GDP",
"repositoryId": 42,
"description": "GDP data by quarter",
"sourceName": "National Statistics Office",
"sourceUrl": "https://example.com/gdp-data"
}
```
Note the dataset `id` — you will use it to upload and download data.
Upload a CSV file to your dataset using a multipart form `PUT` request to `/datasets/{id}/data`:
```bash theme={null}
curl -X PUT https://api.alphacast.io/datasets/101/data \
-u YOUR_API_KEY: \
-F "data=@gdp.csv"
```
Your CSV should have a header row. For example:
```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
```
A successful upload returns `201` with a process object describing the upload job:
```json theme={null}
{
"id": 500,
"datasetId": 101,
"status": "pending",
"createdAt": "2024-01-15T10:30:00"
}
```
Uploads are processed asynchronously. The dataset will be available for download once the process status reaches `"completed"`. You can check status at `GET /datasets/{id}/processes/{process_id}`.
Once the upload is processed, download your dataset using `GET /datasets/{id}/data`. By default the response is a CSV file:
```bash theme={null}
curl https://api.alphacast.io/datasets/101/data \
-u YOUR_API_KEY:
```
You can request other formats using the `$format` query parameter:
```bash CSV (default) theme={null}
curl "https://api.alphacast.io/datasets/101/data" \
-u YOUR_API_KEY:
```
```bash JSON theme={null}
curl "https://api.alphacast.io/datasets/101/data?$format=json" \
-u YOUR_API_KEY:
```
```bash XLSX theme={null}
curl "https://api.alphacast.io/datasets/101/data?$format=xlsx" \
-u YOUR_API_KEY: \
--output gdp.xlsx
```
```bash TSV theme={null}
curl "https://api.alphacast.io/datasets/101/data?$format=tsv" \
-u YOUR_API_KEY:
```
You can also filter and paginate results using OData-style query parameters:
| Parameter | Description |
| - | - |
| `$filter` | OData filter expression, e.g. `Country eq 'USA'` |
| `$select` | Comma-separated column names to include |
| `$top` | Maximum number of rows to return |
| `$last` | Return the last N rows by date |
## Next steps
* Read the [authentication guide](/authentication) for details on both supported auth methods
* Explore the [API reference](/api/overview) for the full list of endpoints and parameters
* Learn how [repositories](/concepts/repositories) control access and visibility for your data
# Summarize with AI
Source: https://learn.alphacast.io/steps/ai-summary
Generate a written summary of the data at this point in the pipeline, regenerated only when the underlying data changes.
The **Summarize with AI** step produces a written summary of the data as it stands at that point in the pipeline. The summary is stored in the step and can be surfaced in dashboards alongside the numbers it describes.
## What gets sent
The step does **not** send the full dataset. It computes a statistical profile — shape, column types, descriptive statistics, and the first and last few rows — and summarizes that.
This matters for two reasons. Large datasets summarize without hitting size limits, and the raw body of your data is not transmitted — only its statistical shape and a small sample of rows.
## Regeneration
The summary is cached against a hash of the data profile:
* **Data unchanged** — the existing summary is kept, so a scheduled rerun doesn't produce a slightly different wording every time.
* **Data changed** — a new summary is generated.
* **Summary edited by hand** — your edit is stored and preserved. You are not overwritten by the next run.
That last behavior makes the step usable for published commentary: let it draft, edit what it got wrong, and your version stays until the underlying data actually moves.
The summary describes what the numbers do, not why. Treat generated commentary as a first draft to check rather than analysis to publish unread — particularly when the output is going somewhere your readers will take as authoritative.
## Next steps
Write commentary yourself instead.
Have AI transform the data rather than describe it.
# Transform with AI
Source: https://learn.alphacast.io/steps/ai-transform
Describe a transformation in plain language and let Alphacast write and run the Python that performs it.
The **Transform with AI** step turns a description of what you want into Python that operates on the pipeline data. You refine the result through a chat conversation; the generated code is what actually runs.
## How it works
The step is split in two: the chat on the left, and the generated **Code** with a **Data Preview** tab on the right.
Write what you want in plain language — "calculate the YTD change of the index". Alphacast reads the data schema first, then explains its plan and generates the code.
The code is a `run(df)` function operating on a pandas DataFrame, shown in full. It is stored in the step configuration — not a hidden black box. Use **Data Preview** to see the result on real data.
Keep the conversation going to adjust the result. Each round generates new code, and earlier versions stay reachable through the **Show Code** links in the chat history.
Generating code does not persist it. **Save the step** to keep the latest generated code — otherwise you lose it when you navigate away.
Until code has been generated, the step passes data through unchanged and reports that no code was provided. Adding the step is therefore always safe — it does nothing until you give it something to do.
## What to know before using it
The generated code is reviewable, and reviewing it is worth the minute it takes. AI-written transformations can be subtly wrong in ways that produce plausible numbers — a misread column, an aggregation over the wrong axis, an off-by-one on a lag. Read the code and check the output against a case you already know.
For transformations that are well covered by a built-in step — a year-over-year change, a resample, a join — prefer the built-in one. It is faster, it is explicit in the pipeline, and there is nothing to review. Reach for AI when the transformation is genuinely custom.
## Next steps
Write a formula yourself, with no code generation.
Generate a written summary of the data instead.
# Create AI View
Source: https://learn.alphacast.io/steps/ai-visualization
Build a chart, table or mini dashboard from the output of one or more earlier steps, generated and versioned by AI.
The **Create AI View** step builds a visualization — a chart, a table, or a small dashboard — from the output of steps earlier in the pipeline. Unlike the other output steps, it can draw on **several** prior steps at once.
## Configuration
| Field | Description |
| - | - |
| Data sources | One or more earlier steps whose output feeds the view, added as **Data source 1**, **2** and so on. |
| Version | AI views are versioned and named — `v1 · EMBI Dashboard`. Pick which version this step renders. |
## Building a view
You can describe the view you want in the prompt, or press **Suggest views** and let Alphacast propose options based on the data it loaded. Suggestions arrive as **Recommended charts**, one flagged **BEST FIT**, each with a **Use this** button that generates the final view.
The prompt also accepts **Attach image** and **Capture current view**, so you can point at a reference design or iterate on what is already rendered.
## What it produces
Despite the name, the output is not limited to a single chart. A view can be a small dashboard combining stat tiles, filter chips and charts — the example above pairs a "top risk mover" tile with country filters and a historical spreads chart.
## Multiple inputs
This is what distinguishes the step from [Create a Chart](/steps/chart-data) and [Create a Table](/steps/table-view), which both work on the single stream of data reaching them. An AI View can combine, say, a monthly series from one branch and a summary table from another into one view — without merging them into a single dataset first.
Large inputs are sampled for rendering — the view reports how many rows it drew from how many loaded. Read the footer before concluding a chart shows the full history.
Every input must be a step whose output has actually been materialized. If you select a step that hasn't run, the view fails with a message naming the input — run the input step first, or pick a different one.
The step requires both a view and a selected version before it will run. Adding it without configuring it stops the pipeline rather than passing through silently, unlike most other steps.
## Next steps
Multiple views with shared filters, for dashboards.
A single chart from the current data.
# Append Dataset
Source: https://learn.alphacast.io/steps/append-dataset
Stack datasets with the same structure on top of each other, with control over duplicate handling.
The **Append Dataset** step combines datasets with the same structure one on top of the other. Use it when the same data lives in separate datasets — different months or years, for example — and you need it as one series.
Select the datasets to append and the variables to include, then choose how duplicates should be handled.
Check that the datasets really do share the same structure before appending. Mismatched column names produce sparse columns rather than an error.
## Fetching and modifying before appending
You can also transform data before it is appended:
In the **Fetch** step, select the dataset you want to take data from, and apply any steps you need.
In the **Append Dataset** step, choose how duplicate records are dropped: keep the first occurrence, keep the last occurrence, or drop all duplicates.
Appending stacks rows vertically. To join datasets side by side on shared entities, use [Merge branches](/steps/merge).
## Next steps
Join datasets on common entities instead.
Restore chronological order after appending.
# Apply Formula
Source: https://learn.alphacast.io/steps/apply-formula
Apply one formula to many columns at once, producing a new suffixed column for each.
The **Apply Formula** step runs a single formula across several columns in one go. Where [Calculate Variable](/steps/calculate-variable) creates one new column from a formula you write, this step applies the same formula to each column you select and produces one new column per input.
## Configuration
| Field | Description |
| - | - |
| Formula | The formula to apply. It operates on each selected column in turn. |
| Columns | The columns to apply it to. |
| Suffix | Appended to each column name to name the result. |
Output columns are named `{original column} - {suffix}`. So applying a formula with the suffix `real` to `Exports` and `Imports` produces `Exports - real` and `Imports - real`, leaving the originals in place.
The formula uses the same grammar as [Calculate Variable](/steps/calculate-variable) — see the [formula reference](/steps/formula-reference) for every operator and function.
The step fails if the formula, the suffix, or the column selection is missing. All three are required.
Reach for this when you would otherwise add the same Calculate Variable step five times with only the column name changing — deflating several nominal series, or converting a group of columns to an index.
## Next steps
Every operator and function available.
Write a formula producing a single new column.
# X13 ARIMA Seasonal Adjustment
Source: https://learn.alphacast.io/steps/arima-sa
Seasonally adjust series with X-13ARIMA-SEATS, with control over model order, outliers, log transformation and forecast horizon.
The **X13 ARIMA Seasonal Adjustment** step removes seasonal variation using X-13ARIMA-SEATS, the procedure maintained by the US Census Bureau. Unlike the prebuilt **Seasonally adjusted** option in [Apply Transform](/steps/transform), this step exposes the model parameters and can also output the trend and irregular components.
## Output columns
For each selected column, the step appends:
| Column | When |
| - | - |
| `{column} - sa` | Always. The seasonally adjusted series. |
| `{column} - trend` | When trendline output is enabled. The trend-cycle component. |
| `{column} - irregular` | When irregular output is enabled. The residual component. |
Original columns are left in place.
## Configuration
Pick the **columns to transform**; everything else sits behind **advanced options**, with defaults that work for most series.
| Field | Description |
| - | - |
| Columns to transform | The numeric columns to adjust. |
| Log Transformation | Whether to take logs. Required if you want to model multiplicative effects on a log scale. |
| Model | **Auto** lets X-13 identify the best model from the data. Otherwise give a 6-digit code — `011011` means an ARIMA (0 1 1)(0 1 1) specification, regular orders first, seasonal orders second. |
| Max Order — Regular / Seasonal Polynomial | Bounds for automatic model identification, previewed as `maxorder = (2, 1)`. Only used when the model is **Auto**. |
| Forecast periods | Number of forecast periods to produce. Defaults to 0. |
| Apply outlier detection | Whether outliers are tested for and corrected when detected. |
| Output trendline | Adds the `- trend` column. |
| Output irregular component | Adds the `- irregular` column. |
## Requirements and failure modes
Seasonal adjustment has real preconditions, and the step raises an error rather than returning a degraded result:
* **Minimum observations.** A series needs more than 36 observations, or more than 12 for quarterly data.
* **No zero or negative values.** Adjustment cannot be applied to series containing them.
* **One model per entity.** Each entity is adjusted independently. If adjustment fails for any entity the step reports which ones and stops, so a partial result is never published silently.
Adjustment runs per entity group and in parallel across columns, so adjusting many series at once is not much slower than adjusting one.
## Next steps
The one-click seasonal adjustment, without model control.
Resample to monthly or quarterly first — X-13 requires one of the two.
# Calculate Variable
Source: https://learn.alphacast.io/steps/calculate-variable
Create new columns with an Excel-like formula parser — arithmetic, row functions, group functions and rolling windows.
The **Calculate Variable** step is an all-purpose formula parser for creating new variables in a familiar, spreadsheet-like way. Dozens of operators, comparisons and functions combine freely.
This page covers how the step works. For the complete list of operators and functions, see the [formula reference](/steps/formula-reference).
## Writing a basic formula
Create a pipeline (**Create new → Pipeline** in the top right), select a data source, then **Add step below → Calculate Variable**.
The rules:
* **Name the variable** in the textbox. Choosing a name that already exists overwrites that column.
* **Type `@` to reference a column.** Start typing the name and matching columns appear.
* **Use basic arithmetic** — `+`, `-`, `*`, `/`, `^`: `@column1 + 3`
* **Call functions** by name followed by parentheses, with commas between parameters: `round(@column) + @column2`
* **The result always has the same number of rows as the input**, even for calculations that would normally reduce dimensionality such as a total per group. See group functions below.
```
@Close + @Volume * 2
```
## Row functions
Row functions use only the values in a single row — no other periods or entities are involved. This includes `power`, `exp`, `sqrt`, `log`, `abs`, `trunc`, `round`, `sin`, `cos` and more.
```
log(@Close) + sqrt(@Volume)
```
## Nested calculations
Calculations nest inside other calculations as parameters:
```
log(exp(@Close))
```
## Group functions
Group functions calculate over subgroups of the dataset. The data is split by the unique values of the entities given as parameters, and the calculation runs separately for each group. Those entities can be the dataset's real entities, any other variable, or even the result of a nested calculation.
```
Cumulative price change for each ticker, against its first price
@Close / first(@Close, @Ticker)
Cumulative sales per salesperson
cumsum(@sales, @salesperson)
Each product's share of total sales on that date
@sales / sum(@sales, @date)
```
## Rolling window functions
Rolling windows are group functions that also calculate within a moving window. You define how many periods the window spans.
```
20-day moving average for each ticker
rollingmean(@Close, 20, @Ticker)
```
## Date and time functions
These operate on datetime variables — usually the `@Date` entity — and include `year`, `month`, `day`, `week`, `dayofyear` and others.
```
Extract the year from the date entity
year(@Date)
```
## Video tutorial
This tutorial is in Spanish.
## Next steps
Every operator and function, grouped by category.
Prebuilt economic transformations that need no formula.
# Apply Country Transform
Source: https://learn.alphacast.io/steps/change-units
Country-specific unit conversions — constant prices, per capita, % of GDP and currency conversion — with explicit control over which country applies.
The **Apply Country Transform** step performs the unit conversions that depend on a country's reference data: inflation indices for constant prices, population for per capita, GDP series for shares of GDP, and exchange rates for currency conversion.
It is the same engine as [Apply Transform](/steps/transform), narrowed to country-dependent conversions and with explicit control over **which country** the reference data comes from.
## Configuration
The step detects the input frequency and offers only the conversions valid for it.
| Field | Description |
| - | - |
| Transformation | Which conversion to apply. The options depend on the detected frequency. |
| Country column | The column holding country values. Defaults to a column named `country` or `Country` when one exists. |
| Country | A fixed country, used instead of a column when the dataset has no country entity. |
| Columns | The columns to convert. Use **Select all** / **Clear selection** for bulk changes. |
This is the step's distinguishing feature. [Apply Transform](/steps/transform) requires the dataset to carry a country entity; here you can point at any column, or declare a single country outright — which is what makes these conversions possible on datasets that never named a country in the first place.
## Available conversions
| Transformation |
| - |
| Currency conversion LCU / USD - daily |
| Currency conversion BCS / USD (Argentina only) |
| Transformation |
| - |
| Constant prices |
| Per Capita |
| % of GDP |
| % of USD GDP |
| Sum last 12 months - % of GDP |
| Currency conversion LCU / USD - monthly |
| Currency conversion BCS / USD (Argentina only) |
| Transformation |
| - |
| Constant prices |
| Per Capita |
| % of GDP |
| Currency conversion LCU / USD - quarterly |
| Currency conversion BCS / USD (Argentina only) |
| Transformation |
| - |
| Constant prices |
| Per Capita |
| % of GDP |
| % of Current USD GDP |
| Currency conversion LCU / USD |
| Currency conversion BCS / USD (Argentina only) |
Each conversion pulls its reference series from Alphacast automatically — the step shows which auxiliary datasets it is using once you pick a transformation.
## Next steps
The full transformation set, including changes and moving averages.
Harmonize country names so the reference data matches.
# Create a Chart
Source: https://learn.alphacast.io/steps/chart-data
Turn pipeline output into a chart and customize it without leaving the pipeline.
**Create a Chart** is one of the pipeline's output steps. It charts the data as it stands at that point and lets you customize the result.
Select the **Create a chart** step and save. The pipeline then asks which variables to chart — either from the pipeline itself or from another dataset:
Once the variables are chosen, configure the chart:
## Customizing
Customization is split across five tabs — **Basic**, **Data**, **Texts**, **Customize** and **Annotations** — each covering a different set of options. [This video](https://www.youtube.com/watch?v=7IU_o6WGLmI\&t=1s) walks through them.
Chart configuration is also available to AI agents: the MCP server exposes the full chart config reference and a validator. See [Grapher tools](/mcp/tools/grapher).
## Next steps
Save the underlying data as an auto-updating dataset.
Produce a downloadable, embeddable snapshot.
# Validate Countries
Source: https://learn.alphacast.io/steps/country-validator
Check country names against a canonical list and decide what happens to the ones that don't match — fail, remove, fuzzy match or rename.
The **Validate Countries** step checks the values of a country column against a canonical country list and normalizes them to a standard name. It is what makes country-dependent transformations reliable: [Apply Transform](/steps/transform) and [Apply Country Transform](/steps/change-units) can only find the right inflation, population or GDP reference series if the country names match.
## Configuration
| Field | Description |
| - | - |
| Column to validate | The entity column holding country names. |
| Matching rule | What to do with values that don't match. See below. |
| Renaming rules | Optional explicit mappings from an original value to a country. Always honored, whichever matching rule is set. |
## Matching rules
| Rule | Behavior |
| - | - |
| **Fail** | Fails the pipeline if a value does not match any country. The default, and the safest. |
| **Remove invalid rows** | Removes rows where the value does not match any country. |
| **Fuzzy** | Matches the value to a country using a fuzzy search. |
The renaming table is prefilled with the values the step could not identify — `Global`, `Latin` and `RD-Latin` in the screenshot above — so you can map the ones that are real countries and decide what to do with the rest.
Fuzzy matching always picks *some* country — it takes the highest-scoring candidate with no minimum threshold. That makes it convenient for near-misses like `Argentina ` or `Brasil`, and risky for values that aren't countries at all. Prefer explicit renaming rules when you know what the odd values are.
Matching is accent- and case-insensitive, so `méxico`, `Mexico` and `MEXICO` all resolve to the same canonical name.
Aggregate labels like `Global`, `Latin` or a regional grouping are not countries and never will be. Leave them unmapped and use **Remove invalid rows**, or split them out with [Filter Entity](/steps/filter-entity) before validating.
The step also fails when two different input values resolve to the **same** country, since that would silently merge rows. It names both values so you can decide which is correct.
## Next steps
Conversions that depend on matching the right country.
Harmonize non-country values by hand.
# Data Snapshot
Source: https://learn.alphacast.io/steps/data-snapshot
Capture the pipeline output as a downloadable, embeddable snapshot in CSV, XLSX or TSV.
**Data Snapshot** is one of the pipeline's output steps. It takes a snapshot of the data as it stands at that point in the pipeline.
The step provides a download link, a code snippet for embedding the data on a website or in an insight, and optionally an excerpt of the pipeline result. Links are available in CSV, XLSX and TSV.
A snapshot is a point-in-time capture. If you need output that stays current as sources update, use [Publish dataset](/steps/publish) instead.
## Next steps
Produce an auto-updating dataset rather than a snapshot.
Visualize the same output.
# Create a Deck of Views
Source: https://learn.alphacast.io/steps/deck-view
Build multiple charts and tables over one dataset, sharing a common set of filters, for use in dashboards.
The **Create a Deck of views** step produces several views — charts, tables and filters — over the same data, sharing one set of controls. In a dashboard, changing a filter updates every view in the deck at once.
Use it when the same dataset deserves more than one perspective: a headline chart, a breakdown table, and a country selector that drives both.
## How it differs from the single-view steps
| Step | Produces |
| - | - |
| [Create a Chart](/steps/chart-data) | One chart from the current data. |
| [Create a Table](/steps/table-view) | One table from the current data. |
| **Create a Deck of views** | Several views over the current data, with shared filters. |
| [Create AI View](/steps/ai-visualization) | A view combining the output of **several different steps**. |
The deck operates on the single stream of data reaching it. If you need to combine separate branches of the pipeline into one view, that is what [Create AI View](/steps/ai-visualization) does.
The deck captures the data as it stands at that point, so place the step after every transformation, filter and ordering step you want reflected in the views.
## Next steps
Combine output from several steps into one view.
Also persist the underlying data as a dataset.
# Fetch API Explorer Data
Source: https://learn.alphacast.io/steps/fetch-api-provider
Import series from any connected external data provider — central banks, statistics offices and international organizations.
The **Fetch API Explorer Data** step imports series directly from an external data provider, without going through an Alphacast dataset first. It covers the same 30+ connectors documented in [Data providers](/concepts/data-providers) — central banks, national statistics offices, market data sources and international organizations.
## Configuration
| Field | Description |
| - | - |
| Provider | The external provider to pull from. One provider per step. |
| Series | The series to fetch from that provider. Each entry carries the provider's own series identifier. |
| Output format | **Wide** gives one column per series. **Long** stacks them with `Provider` and `Series` columns alongside the provider's own entity dimensions. |
## Wide vs long
In **long** format the output carries `Date`, `Provider`, `Series`, any entity dimensions the provider returns, and `Value`. This is the better choice when you are fetching many series from one provider and want to filter or group them downstream.
In **wide** format each series becomes its own column, joined on date.
Some providers require an API key. Keys are stored per user, not per pipeline — see [Data providers](/concepts/data-providers) for how to save one, and [Provider tools](/mcp/tools/providers) for managing them through an agent.
The step fails if no provider or no series is configured, if a series returns no data, or if a configured series is missing its identifier.
To find the right provider and series identifier before building the step, browse the catalog through the [API](/api/providers/list) or ask an agent using the [provider tools](/mcp/tools/providers).
## Next steps
The full catalog of connected providers.
Turn the fetched series into an auto-updating dataset.
# Fetch Alphacast Dataset
Source: https://learn.alphacast.io/steps/fetch-dataset
Pull an existing Alphacast dataset into a pipeline as its starting point.
The **Fetch Alphacast Dataset** step chooses the dataset that the rest of your pipeline steps operate on. It is predefined when you create a pipeline and is almost always the first step.
## Select a dataset
Start typing in the search box and matching datasets appear as you type. Pick the one you want and save the step.
You can only fetch datasets you have read access to. See [Repositories](/concepts/repositories) for how access levels work.
## Next steps
Narrow the dataset down to the columns you need.
Restrict the pipeline to a date range.
# Fetch FRED Data
Source: https://learn.alphacast.io/steps/fetch-fred
Import economic time series from the St. Louis Fed's FRED database into a pipeline by series code.
[FRED](https://fred.stlouisfed.org/) is the database maintained by the Federal Reserve Bank of St. Louis, with hundreds of thousands of US and international time series drawn from over a hundred sources. The **Fetch FRED Data** step imports any of them into a pipeline.
Click **Create new pipeline** in the top right corner, choose the repository and a name, then click **Create**.
Every FRED series has a unique code, shown both in the page URL and next to the series name. In the example below the codes are `T10Y2Y` and `MORTGAGE30US`.
Add as many series as you need, separated by commas. See a [working example pipeline](https://www.alphacast.io/pipelines/2022-6-10-xaJGgt/view).
Once the step runs you can publish the result as a dataset, chart it, or keep transforming it with further steps.
FRED series can also be browsed and fetched through the Data Providers API — see [Data providers](/concepts/data-providers).
## Next steps
Save the result as an auto-updating dataset.
Compute year-over-year changes, moving averages and more.
# Fetch Alphacast Series
Source: https://learn.alphacast.io/steps/fetch-series
Pull individual Alphacast series into a pipeline by series ID, in wide or long format, with optional scale conversion.
The **Fetch Alphacast Series** step imports one or more individual series rather than a whole dataset. Use it when you need a handful of specific indicators that live in different datasets.
## Configuration
| Field | Description |
| - | - |
| Series | The series to import. Each entry is identified by its series ID. |
| Output format | **Wide** gives one column per series, joined on date. **Long** gives `Date`, `Country` and `Value` columns, with the series stacked. |
| Scale | Optional. Converts every series to a single unit scale so values are comparable. |
## Wide vs long
**Wide** is the default. Series are merged on `Date` with an outer join, so the output covers the union of all dates and leaves gaps where a series has no observation.
**Long** stacks the series instead, adding a `Country` entity column. Pick this when the series share a meaning and differ by country — it keeps the data in the shape most Alphacast charts and dashboards expect.
If every series resolves to the same country and that country is unknown, the `Country` column is dropped rather than filled with a placeholder.
The step fails if a configured series ID cannot be found, or if a scale conversion is impossible between the source and target units. It does not skip the series silently.
## Next steps
Import a whole dataset instead of individual series.
Reduce an existing dataset down to specific series.
# Fetch Financial Data
Source: https://learn.alphacast.io/steps/fetch-yahoo
Import stocks, ETFs, indices and other financial assets from Yahoo Finance into a pipeline by ticker.
Yahoo Finance covers hundreds of thousands of financial assets — stocks, bonds, ETFs and indices — all reachable from an Alphacast pipeline.
Click **Create new pipeline** in the top right corner, choose the repository and a name, then click **Create**.
Add as many tickers as you want, separated by commas — for example `NQ=F, AAPL, MSFT` — and choose the lookback period.
Press **Save** to keep your changes in the step.
The output includes open, close, high, low, volume, dividends and stock split data for every ticker.
## Finding tickers
A Yahoo Finance ticker is a short combination of letters and numbers identifying a company and its share class — `AAPL` for Apple Inc., `MSFT` for Microsoft Corporation. Look up the code on the official Yahoo Finance page for the asset.
Alphacast can resolve tickers for you. The MCP server exposes ticker search and ISIN lookup tools — see [Tickers](/mcp/tools/tickers).
## Next steps
Estimate 132 technical indicators on the price series.
Build tear sheets and rolling performance stats.
# Filter Dates
Source: https://learn.alphacast.io/steps/filter-dates
Restrict a pipeline to a fixed date range or to a window defined relative to today.
The **Filter Dates** step narrows the pipeline to the time period you want to focus on. It supports two modes.
## Absolute date range
Specify a start and end date by clicking the calendar.
You can also click **earliest available** to pull the full history, and **latest available** to always track the most recent data point without editing the step again.
## Relative dates
Click **relative dates** to filter against a window measured from the current date. Choose a number of years, quarters, months or days.
Relative dates keep a scheduled pipeline pointed at a rolling window — for example the last 24 months — without any maintenance.
Remember to save the step before moving to the next one.
## Next steps
Resample the series to a different time frequency.
Filter by value rather than by date.
# Filter Entity
Source: https://learn.alphacast.io/steps/filter-entity
Keep only the entities you want to work with — countries, categories or tickers — and drop the rest.
The **Filter Entity** step narrows a dataset down to specific entity values, so the following steps only process the rows you care about.
In this example, you pick the category you want to work with:
From this point on the pipeline carries only "Capital Accounts" — every other entity is dropped.
Click **Save** and the pipeline reruns with the filter applied.
Entity columns are the columns that uniquely identify a row. See [Regroup entities](/steps/regroup-entities) if you need to collapse an entity rather than filter it.
## Next steps
Filter by value instead of by entity.
Restrict the pipeline to a date range.
# Filter Rows
Source: https://learn.alphacast.io/steps/filter-rows
Drop rows that don't meet a condition, using the same formula grammar as Calculate Variable.
The **Filter Rows** step keeps rows that satisfy a condition — either rows from a specific date onward, or rows whose values meet a criterion you define.
The criterion can be a logical function, an arithmetic operation, or a comparison — anything that evaluates to true or false for a row.
Conditions use the same grammar as [Calculate Variable](/steps/calculate-variable). See the [formula reference](/steps/formula-reference) for the full list of operators, comparisons and functions.
## Next steps
Every operator and function available in a condition.
Order the surviving rows.
# Formula Reference
Source: https://learn.alphacast.io/steps/formula-reference
Every operator, comparison and function available in the Alphacast formula editor — row, group, rolling window and date functions.
This is the complete grammar accepted by the Alphacast formula editor. It applies to [Calculate Variable](/steps/calculate-variable), the conditions in [Filter Rows](/steps/filter-rows), and the **Apply Formula** step.
[Regroup Entities](/steps/regroup-entities) does **not** use this grammar — it offers a fixed list of aggregations instead.
Reference a column with `@` followed by its name — `@Close`, `@Date`, `@sales`.
Function names are case-insensitive: `SUM`, `sum` and `Sum` all resolve to the same function.
## Operators
| Operator | Meaning | Example |
| - | - | - |
| `+` | Add | `A + B` |
| `-` | Subtract | `A - B` |
| `*` | Multiply | `A * B` |
| `/` | Divide | `A / B` |
| `^` | Power | `A ^ B` |
## Comparison
| Operator | Meaning |
| - | - |
| `>` | Greater than |
| `>=` | Greater than or equal |
| `<` | Less than |
| `<=` | Less than or equal |
| `=` | Equal |
| `!=` | Not equal |
| `<>` | Not equal |
## Logical
| Function | Syntax |
| - | - |
| `and` | `and(conditionA, conditionB)` |
| `or` | `or(conditionA, conditionB)` |
| `xor` | `xor(conditionA, conditionB)` |
| `not` | `not(conditionA)` |
| `is_null` | `is_null(@variable)` |
## Shift and IF
| Function | Description | Syntax |
| - | - | - |
| `SHIFT` | Shifts the index by a number of periods, giving access to lagging or leading values. | `SHIFT(variable, lags_or_leads)` |
| `IF` | Returns one value or another based on a condition. | `IF(condition, value_if_true, value_if_false)` |
```
Daily percent change of @Close
@Close / SHIFT(@Close, 1) - 1
Return 1 if the change is positive, -1 otherwise
IF(@pct_change >= 0, 1, -1)
```
## Row functions
Calculated across all values of the column, using only the current row — unlike the group functions below.
| Function | Description | Syntax |
| - | - | - |
| `power` | Power | `power(A, B)` |
| `exp` | Exponential | `exp(A)` |
| `sqrt` | Square root | `sqrt(A)` |
| `log` | Natural logarithm | `log(A)` |
| `log10` | Base-10 logarithm | `log10(A)` |
| `sgn` | Sign: 1 if positive, -1 if negative | `sgn(A)` |
| `abs` | Absolute value | `abs(A)` |
| `trunc` | Truncate to integer | `trunc(A)` |
| `round` | Round to N digits | `round(A, N)` |
| `floor` | Closest integer lower than or equal to the value | `floor(A)` |
| `ceil` | Closest integer higher than or equal to the value | `ceil(A)` |
| `sin` | Sine | `sin(A)` |
| `cos` | Cosine | `cos(A)` |
| `tan` | Tangent | `tan(A)` |
| `hypot` | Euclidean distance — the hypotenuse of A and B | `hypot(A, B)` |
| `multiply` | Multiplies two values, equivalent to `A * B` | `multiply(A, B)` |
| `nan_to_num` | Replaces NaN with 0, and infinities with large finite numbers | `nan_to_num(A)` |
| `all` | True when every argument is true. Accepts any number of arguments | `all(A, B, ...)` |
## Group functions
Calculated within groups. Groups are defined by the columns passed as parameters; by default they are the entities of the dataset, excluding the date column.
| Function | Description |
| - | - |
| `rank` | Numerical data ranks, 1 through n — `rank(@Variable, @entity1, @entity2, ...)` |
| `cummax` | Cumulative maximum per group |
| `cummin` | Cumulative minimum per group |
| `cumprod` | Cumulative product per group |
| `cumsum` | Cumulative sum per group |
| `cumcount` | Cumulative count per group |
| `backfill` | Backfills NA values, up to a limit of consecutive values — `backfill(@Variable, limit, @entity1, ...)` |
| `pad` | Forward-fills NA values — `pad(@Variable, @entity1, ...)` |
| `pct_change` | Percent change against N leading or lagging values within the group — `pct_change(@Variable, N, @entity1, ...)` |
| `quantile` | Quantile position within the group — `quantile(@Variable, quantile, @entity1, ...)` |
| `count` | Count of values in the group |
| `nunique` | Number of unique values in the group |
| `first` | First value of the group |
| `last` | Last value of the group |
| `max` | Maximum of the group values |
| `min` | Minimum of the group values |
| `mean` | Mean of the group values |
| `median` | Median of the group values |
| `prod` | Product of the group values |
| `size` | Size of the group |
| `sem` | Standard error of the mean of the group |
| `std` | Standard deviation of the group |
| `sum` | Sum of the group values |
| `var` | Variance of the group values |
## Rolling window functions
Calculated over a rolling window, within groups. Groups are defined the same way as above.
| Function | Description |
| - | - |
| `rollingcount` | Count over a rolling window |
| `rollingsum` | Sum over a rolling window |
| `rollingmean` | Mean over a rolling window |
| `rollingmedian` | Median over a rolling window |
| `rollingvar` | Variance over a rolling window |
| `rollingstd` | Standard deviation over a rolling window |
| `rollingmin` | Minimum over a rolling window |
| `rollingmax` | Maximum over a rolling window |
| `rollingsem` | Standard error of the mean over a rolling window |
| `rollingrank` | Numerical data ranks over a rolling window — `rollingrank(@Variable, window_N, @entity1, ...)` |
| `rollingcov` | Covariance between two variables over a rolling window — `rollingcov(@VariableA, @VariableB, window_N, @entity1, ...)` |
## Date and time functions
| Function | Returns |
| - | - |
| `now` | Current time — `now()` |
| `today` | Current date — `today()` |
| `year` | The year of the datetime |
| `month` | The month of the datetime |
| `day` | The day of the datetime |
| `hour` | The hour of the datetime |
| `minute` | The minutes of the datetime |
| `second` | The seconds of the datetime |
| `date` | The date part of the datetime |
| `time` | The time part of the datetime |
| `dayofyear` / `day_of_year` | The ordinal day of the year |
| `weekofyear` / `week` | The week ordinal of the year |
| `dayofweek` / `day_of_week` / `weekday` | Day of the week, Monday = 0 to Sunday = 6 |
| `quarter` | Quarter of the date: Jan–Mar = 1, Apr–Jun = 2, and so on |
| `days_in_month` | Number of days in the month of the datetime |
| `is_month_start` | Whether it is the first day of the month, as defined by the frequency |
| `is_month_end` | Whether it is the last day of the month |
| `is_quarter_start` | Whether it is the first day of the quarter |
| `is_quarter_end` | Whether it is the last day of the quarter |
| `is_year_start` | Whether it is the first day of the year |
| `is_year_end` | Whether it is the last day of the year |
| `is_leap_year` | Whether the date falls in a leap year |
The same grammar is available to AI agents through the `get_pipeline_formula_reference` tool on the Alphacast MCP server — see [Pipeline tools](/mcp/tools/pipelines).
## Next steps
How to use these formulas in a pipeline step.
Use comparisons and logical functions as row conditions.
# Add Markdown Text
Source: https://learn.alphacast.io/steps/markdown
Add formatted notes, documentation and section headers inline in a pipeline.
The **Add markdown text** step renders a block of Markdown inside the pipeline. It does not read or modify the data — it exists to document the pipeline for whoever opens it next.
## Configuration
| Field | Description |
| - | - |
| Content | The Markdown to render. Supports headings, lists, links, bold and italic, and code spans. |
## What to use it for
* Explaining a non-obvious transformation or the assumption behind a formula.
* Recording where a source dataset came from and how often it updates.
* Splitting a long pipeline into labelled sections so the step list is readable.
* Noting known caveats in the data for downstream consumers.
A pipeline that publishes a dataset other people rely on is worth documenting inline. The Markdown step keeps that context next to the logic it describes, rather than in a separate document that drifts out of date.
This step affects only what is displayed in the pipeline editor. It passes its input through unchanged, so it is safe to insert anywhere.
## Next steps
Save the pipeline output as a dataset.
Produce a downloadable, embeddable snapshot.
# Melt (Wide to Long)
Source: https://learn.alphacast.io/steps/melt-dataset
Convert a wide-format dataset to long format, collapsing value columns into rows under a new variable column.
**Melt** goes from wide to long: several value columns collapse into two — one holding the former column names, one holding the values. It is the inverse of [Unstack (Long to Wide)](/steps/unstack-dataset), which is where the shared long-versus-wide diagram lives.
## Configuration
Define:
* The name of the column that will host the former column names — the tickers, in the example below.
* The name of the column that will hold the values.
* Which columns should be melted. Uncheck the ones that should stay as columns.
The result carries one row per combination of the retained entities and the melted variable:
Long format is usually what you want before [Regroup entities](/steps/regroup-entities) or before publishing a dataset that other people will filter by entity.
## Next steps
The inverse operation, with the full worked example.
Aggregate once the data is in long format.
# Merge with Dataset
Source: https://learn.alphacast.io/steps/merge
Join two datasets on their common entities, choosing which rows survive when they don't match.
The **Merge with Dataset** step combines datasets through their shared entities. You choose which entities match, and what happens to rows that have no counterpart in the other dataset.
## Why not a spreadsheet
If you have joined data sources before, you have probably done it with some combination of `VLOOKUP`, `HLOOKUP` and `MATCH`. That works well until:
1. You have **many** rows — `VLOOKUP` gets slow.
2. You need to match on more than one field.
3. The position of rows or columns changes.
4. You only want the rows present in both datasets.
5. A source changes its number of rows and you have to re-copy or adjust formulas.
A pipeline merge handles all five, and keeps the datasets connected so the result updates when the sources do.
## How to merge
Go to **Create new → Pipeline**, select the repository and a name. In **Fetch dataset**, pick the first dataset and press **Save**.
Click **Add step below** and choose **Merge with Dataset**, then select the second dataset.
Merges work best when both datasets share a frequency. If they don't, run [Change frequency](/steps/resample) first.
Tell the system which fields join the two datasets.
* Usually there is a single **Date** field, and the datasets merge on it.
* Datasets can have more than one entity — data by date *and* by country, for example. In that case identify which field of the second dataset corresponds to the country field of the first.
* If no second field is selected, the join happens on date alone. Rows from dataset B may then appear duplicated when a date occurs more than once in dataset A.
In this example two monthly datasets share the same entity (Argentina). With **Left join**, all rows from the first dataset (EMAE) are kept, and Consumer Price Index values are attached wherever date and entity match.
| Join | Result |
| - | - |
| **Inner** | Only rows that match in both datasets. |
| **Left** | All rows of dataset A; unmatched rows of B are discarded. |
| **Right** | All rows of dataset B; unmatched rows of A are discarded. |
| **Outer** | All rows from both datasets, matched or not. |
The result combines the columns of both datasets. Carry on transforming it, or [publish](/steps/publish) it as a new dataset.
To stack datasets vertically rather than join them side by side, use [Append branches](/steps/append-dataset).
## Next steps
Combine datasets with the same structure end to end.
Compute new columns across the merged data.
# Pipeline Steps
Source: https://learn.alphacast.io/steps/overview
How pipelines work in Alphacast, and a map of every step available — from importing data to publishing the result.
A **pipeline** is an ordered chain of steps that turns source data into something you can publish, chart or download. Each step takes the output of the previous one as its input, so the data is reshaped progressively from the first step to the last.
Pipelines are reproducible: when a source dataset updates, the pipeline reruns and everything downstream follows. That is what makes a [published dataset](/steps/publish) stay current without anyone touching it.
## The shape of a pipeline
Every pipeline starts by bringing data in — from an existing Alphacast dataset, or from an external source like FRED or Yahoo Finance.
Narrow the data to what you need and get it into the right shape: select columns, filter rows and entities, resample, join or pivot.
Compute new variables, apply economic transformations, or run a domain model.
Publish a dataset, build a chart, or produce a downloadable snapshot.
## Every step
### Import data
| Step | What it does |
| - | - |
| [Fetch Alphacast Dataset](/steps/fetch-dataset) | Pull an existing Alphacast dataset into the pipeline. |
| [Fetch FRED Data](/steps/fetch-fred) | Import economic series from the St. Louis Fed by series code. |
| [Fetch Financial Data](/steps/fetch-yahoo) | Import stocks, ETFs and indices by ticker. |
| [Fetch Alphacast Series](/steps/fetch-series) | Import individual series by ID, wide or long. |
| [Fetch API Explorer Data](/steps/fetch-api-provider) | Import directly from a connected external provider. |
### Filter and select
| Step | What it does |
| - | - |
| [Select Columns](/steps/select-columns) | Keep only the columns you need. |
| [Filter Entity](/steps/filter-entity) | Keep only certain countries, categories or tickers. |
| [Filter Dates](/steps/filter-dates) | Restrict to an absolute or relative date range. |
| [Filter Rows](/steps/filter-rows) | Drop rows that don't meet a condition. |
| [Sort Rows](/steps/sort-rows) | Order rows by one or more columns, each with its own direction. |
| [Select Series](/steps/select-series) | Reduce the data to specific variable and entity combinations. |
### Reshape
| Step | What it does |
| - | - |
| [Reorder Columns](/steps/reorder-columns) | Set the order columns appear in. |
| [Rename Columns](/steps/rename-columns) | Give columns new names. |
| [Regroup Entities](/steps/regroup-entities) | Drop an entity and aggregate — the equivalent of GROUP BY. |
| [Change Frequency](/steps/resample) | Resample to a different time frequency. |
| [Merge with Dataset](/steps/merge) | Join two datasets on their common entities. |
| [Append Dataset](/steps/append-dataset) | Stack datasets with the same structure. |
| [Long to Wide (Unstack)](/steps/unstack-dataset) | Pivot from long format to wide. |
| [Wide to Long (Melt)](/steps/melt-dataset) | Collapse from wide format to long. |
| [Rename Values](/steps/rename-values) | Replace values inside an entity or string column. |
| [Reorder Rows](/steps/reorder-rows) | Put entity values in a deliberate, non-alphabetical order. |
### Transform and analyze
| Step | What it does |
| - | - |
| [Apply Transform](/steps/transform) | Prebuilt transformations — YoY change, moving averages, per capita, constant prices. |
| [Apply Country Transform](/steps/change-units) | Country-specific conversions, with explicit control over the country. |
| [Apply Formula](/steps/apply-formula) | Apply one formula to many columns at once. |
| [Calculate variable](/steps/calculate-variable) | Create columns with an Excel-like formula parser. |
| [X13 ARIMA Seasonal Adjustment](/steps/arima-sa) | Seasonal adjustment with full model control. |
| [Validate Countries](/steps/country-validator) | Normalize country names against a canonical list. |
| [Technical Analysis](/steps/talib) | 132 technical indicators for financial assets. |
| [Portfolio Analysis](/steps/portfolio-analysis) | Tear sheets and rolling performance stats. |
The [formula reference](/steps/formula-reference) documents the grammar shared by **Calculate variable**, **Filter rows** and **Apply Formula**.
### AI steps
| Step | What it does |
| - | - |
| [Transform with AI](/steps/ai-transform) | Describe a transformation and let AI write the Python. |
| [Summarize with AI](/steps/ai-summary) | Generate a written summary of the data. |
| [Create AI View](/steps/ai-visualization) | Build a view from the output of several earlier steps. |
### Outputs
| Step | What it does |
| - | - |
| [Publish to Dataset](/steps/publish) | Write the result to an auto-updating dataset. |
| [Create a Chart](/steps/chart-data) | Build and customize a chart. |
| [Create a Table](/steps/table-view) | Render the data as a table for a dashboard. |
| [Create a Deck of views](/steps/deck-view) | Several views over one dataset, with shared filters. |
| [Data Snapshot](/steps/data-snapshot) | Produce a downloadable, embeddable snapshot. |
| [Add markdown text](/steps/markdown) | Document the pipeline inline. |
Pipelines can also be built and run by AI agents. The Alphacast MCP server exposes the full pipeline lifecycle — creating pipelines, adding and editing steps, previewing output and triggering runs. See [Pipeline tools](/mcp/tools/pipelines).
## Next steps
Start a pipeline from an existing dataset.
Every operator and function available in a formula field.
# Portfolio Statistics and Tear Sheets
Source: https://learn.alphacast.io/steps/portfolio-analysis
Design and test portfolio and trading strategies — tear sheets from daily returns, plus dynamic rolling stats.
Alphacast pipelines can be used to design and test portfolio and trading strategies. The **Portfolio Analysis** step produces tear sheets from daily returns, and dynamic rolling statistics across timeframes.
## 1. Load data and calculate daily returns
Any dataset works. As an example, load Yahoo Finance data and compute daily returns for three assets:
**Create new → Pipeline**.
Add the tickers you want to analyze — `MSFT`, `AAPL`, `GOOG` — and select the period.
Add a [Calculate Variable](/steps/calculate-variable) step with the formula:
```
pct_change(@Close, 1, @Ticker)
```
## 2. Calculate the tear sheet
Add a **Portfolio Analysis** step, choose the metrics to compute, and select the column holding the daily returns — `pct_change` in this example.
Available statistics: annual return, cumulative returns, annual volatility, Sharpe ratio, Calmar ratio, stability, max drawdown, Omega ratio, Sortino ratio, skew, kurtosis, tail ratio, daily value at risk, and total return.
### Tear sheet on
A single tear sheet is calculated for the whole sample period.
### Tear sheet off
Statistics are estimated recursively for each day of the sample, each one computed from that day up to the most recent one. Two extra parameters apply:
| Parameter | Meaning |
| - | - |
| `dropLastN` | Statistics are not calculated for timeframes beginning in the last N days. Defaults to excluding 252 trading days. |
| `Skip days` | Start days are sampled every N days rather than daily. Matters for performance. Defaults to 10 days. |
The result looks like [this dataset](https://www.alphacast.io/datasets/23156).
## Optional: add technical indicators
The [Technical Analysis](/steps/talib) step estimates 132 metrics on the same price data — cycle, momentum, volatility and volume indicators, overlap studies, pattern recognition and statistics functions.
## Next steps
132 technical indicators for the same assets.
Save the tear sheet as an auto-updating dataset.
# Publish to Dataset
Source: https://learn.alphacast.io/steps/publish
Write pipeline output to a dataset that updates automatically whenever the pipeline runs.
**Publish to Dataset** is one of the pipeline's output steps. It creates a dataset that is automatically kept up to date by the pipeline.
Once you have made every transformation you need, publish the result as a dataset. The step lets you choose the dataset name and the repository it is stored in.
After naming and saving, click the link to navigate to the new dataset.
You need write access to the destination repository. See [Repositories](/concepts/repositories) for how permission levels work.
A published dataset is a first-class dataset: it can be queried through the [API](/api/datasets/data), read with the [Python SDK](/python-sdk/downloading), and fetched by other pipelines with [Fetch Dataset](/steps/fetch-dataset).
## Next steps
Chart the result instead of, or as well as, publishing it.
Produce a downloadable, embeddable snapshot.
# Regroup Entities
Source: https://learn.alphacast.io/steps/regroup-entities
Drop an entity column and aggregate the remaining rows with a formula — the equivalent of GROUP BY.
The **Regroup Entities** step removes an entity and regroups the data by the ones that remain, using a formula you choose to aggregate. It is the equivalent of **GROUP BY** in SQL or `groupby` in pandas.
## Why entities need care
Entity columns are the columns required to **uniquely** identify a row. Because of that, a combination of entity values can never repeat — which makes removing or changing entities a delicate operation that can corrupt the data if done carelessly.
Say you have a dataset with Date and Country as entities, the most common combination in Alphacast. You will have many rows for the same date, one per country. **You cannot simply drop the Country column**, because dates would then repeat and entity combinations must be unique.
Regrouping is how you resolve this.
## How to regroup
Start from a [Fetch Dataset](/steps/fetch-dataset) step.
Deselect the entities you want to remove.
Decide how rows that now share the same entity values should be combined — the Date, in the example above.
The aggregation is set **per column**, so different columns can be combined differently in the same step. The right choice depends entirely on what each column represents.
| Aggregation | What it does |
| - | - |
| `sum` | Total of the group's values. |
| `mean` / `avg` | Arithmetic mean, ignoring nulls. |
| `median` | Median, ignoring nulls. |
| `min` / `max` | Smallest or largest value in the group. |
| `count` | Number of non-zero values. |
| `product` | Product of the group's values. |
| `std` / `var` | Standard deviation or variance, ignoring nulls. |
| `first` / `last` | First or last value in the group. |
| `meanw` | Weighted mean. Requires a weight column. |
| `sumw` | Weighted sum. Requires a weight column. |
| `drop` | Discards the column instead of aggregating it. |
Weighted aggregations are the right choice when combining rates or ratios across entities — a weighted mean of inflation across countries needs a population or GDP weight column, since a plain mean would treat every country equally.
The result keeps every entity except the ones you excluded, and has fewer rows than the original because rows sharing entity values are collapsed together.
This step uses the fixed list of aggregations above, not the formula editor. To compute a value that isn't in the list, add a [Calculate Variable](/steps/calculate-variable) step before or after regrouping.
## Next steps
Compute values the fixed aggregations don't cover.
Aggregate along the time dimension instead.
# Rename Columns
Source: https://learn.alphacast.io/steps/rename-columns
Give columns new names, or leave them unchanged, before publishing or charting.
The **Rename Columns** step maps existing column names to new ones.
Fill in the blank space to the right of a column to set its new name. Leave the space blank to keep the original.
Rename columns before a [Merge](/steps/merge) when both datasets carry a column with the same name — it makes the join result far easier to read.
## Next steps
Set the order columns appear in.
Combine this data with another dataset.
# Rename Values
Source: https://learn.alphacast.io/steps/rename-values
Replace values inside an entity or string column — harmonizing country names, categories or labels across sources.
The **Rename Values** step replaces values *inside* a column, rather than renaming the column itself. Use it to harmonize labels that mean the same thing but are spelled differently across sources — `USA`, `U.S.A.` and `United States`, for example.
## Configuration
| Field | Description |
| - | - |
| Column | The entity or string column whose values you want to rename. |
| Renaming rules | A set of old-value to new-value pairs. Values you don't list are left untouched. |
The step reads the distinct values present in the chosen column and offers them for mapping, so you can see exactly what is there before writing rules.
The step fails if the dataset has no entity or string columns, if no column is selected, if the selected column is not present at that point in the pipeline, or if no renaming rules are defined.
To rename a **column**, use [Rename Columns](/steps/rename-columns). To harmonize country names specifically, [Validate Countries](/steps/country-validator) does it against a canonical country list instead of rules you write by hand.
## Next steps
Harmonize country names automatically.
Rename the columns themselves.
# Reorder Columns
Source: https://learn.alphacast.io/steps/reorder-columns
Set the order in which columns appear in the pipeline output.
The **Reorder Columns** step changes the order columns appear in. Useful when your analysis — or the dataset you publish — needs a specific layout.
Click **Up** or **Down** to move a column:
Reordering is presentational: no values change and no rows are affected.
## Next steps
Change column names as well as their order.
Save the result with the layout you set.
# Reorder Rows
Source: https://learn.alphacast.io/steps/reorder-rows
Put entity values in a deliberate, non-alphabetical order — useful when chart and table legends should follow a specific sequence.
The **Reorder Rows** step arranges rows by putting the values of an entity column into an explicit order you define. Unlike [Sort Rows](/steps/sort-rows), which sorts by value, this step lets you impose an order that isn't alphabetical or numerical — regions ordered by size, categories in reporting order, countries in a conventional sequence.
## Configuration
| Field | Description |
| - | - |
| Column to reorder | The entity column whose values you want to order. |
| Values order | The distinct values found in that column, listed with their position. Drag a row by its handle to move it. |
Rows are then sorted by that sequence and, within it, by date.
Any value present in the data but missing from your list is appended after the ones you ordered, rather than dropped. You only need to list the values you care about positioning.
The step fails if the dataset has no entity columns, or if the selected column is not present at that point in the pipeline.
This matters most right before an output step. Legend and series order in [Create a Chart](/steps/chart-data) and row order in [Create a Table](/steps/table-view) follow the order the data arrives in.
## Next steps
Sort by value rather than by an explicit sequence.
Change column order instead.
# Change Frequency
Source: https://learn.alphacast.io/steps/resample
Resample a dataset to a different time frequency, interpolating up or aggregating down.
Every dataset has a frequency — daily, weekly, monthly, quarterly or yearly. The **Change Frequency** step converts between them and recalculates the values accordingly.
Moving from a higher to a lower frequency requires an **aggregation** formula, such as average or end of period. Moving from a lower to a higher frequency requires an **interpolation** formula, such as linear interpolation or splines.
## How to resample
The system detects the input frequency automatically.
This determines whether the step interpolates or downscales.
**Going up in frequency** (monthly to daily) offers 9 interpolation options: Repeat, Linear, Quadratic, Cubic, Polynomial order 3, Piecewise Polynomial, Spline, Krogh, and Fill with 0.
**Going down in frequency** (monthly to quarterly) offers 6 aggregations: Average, Sum, Min, Max, Last and First.
Interpolating to a higher frequency invents data points that were never observed. It is appropriate for aligning series before a join, but the interpolated values should not be treated as measurements.
## Next steps
Join series once they share a frequency.
Frequency-aware transformations like year-over-year change.
# Select Columns
Source: https://learn.alphacast.io/steps/select-columns
Keep only the columns you need, reducing the data processed by every downstream step.
The **Select Columns** step filters columns down to the ones you care about, cutting the volume of data processed by the steps that follow. The variable selector shows the data as it stands at that point in the pipeline.
Entity columns — the date and dimension columns that uniquely identify a row — are always retained.
Remember to save the step before moving to the next one.
## Next steps
Give the surviving columns clearer names.
Set the order columns appear in.
# Select Series
Source: https://learn.alphacast.io/steps/select-series
Reduce a dataset to specific series — a variable combined with one set of entity values — and flatten them into named columns.
The **Select Series** step reduces a dataset down to the individual series you want. A *series* here is one variable paired with one combination of entity values — "Argentina + Consumer Price Index", for example.
## How series are enumerated
The step scans the dataset and builds the list of available series by crossing every non-entity variable with every distinct combination of entity values. Combinations with no data for that variable are left out, so the picker only shows series that actually exist.
## Configuration
| Field | Description |
| - | - |
| Series | The series to keep. Tick them individually, or use **Select all** / **Clear all**. |
| Series name mask | A template for naming the resulting columns. |
Each entity column and the variable become filterable columns in the picker, so you can narrow a long list before selecting.
## Naming with a mask
The **series name mask** names every resulting column from a template, using the entity and variable names as placeholders. The default is:
```
{country} - {Variable}
```
which produces `Argentina - EMBI Global Diversified Subindices`. Edit the mask and press **Apply to all** to rename every selected series at once.
Trim the mask to just `{country}` when every series is the same variable — the variable name in each column then becomes noise rather than information.
The output is flattened: entity columns disappear and each selected series becomes its own column keyed on date. This is close to what [Unstack](/steps/unstack-dataset) does, but driven by an explicit selection rather than by pivoting a whole column.
Leaving the selection empty passes the data through untouched, so you can add the step early and fill it in once you can see the available series.
## Next steps
Keep entity structure and filter by value instead.
Chart the selected series.
# Sort Rows
Source: https://learn.alphacast.io/steps/sort-rows
Order rows by one or more columns, each with its own ascending or descending direction.
The **Sort Rows** step reorders the rows of the dataset by the columns you choose.
## Configuration
Add one or more sort columns. Each one carries **its own direction**, so you can sort by date descending and then by country ascending in the same step.
| Field | Description |
| - | - |
| Column | A column to sort by. Columns apply in the order you add them: the first is the primary sort key, later ones break ties. |
| Sort order | Direction for **that column** — ascending (lowest to highest, A to Z) or descending. |
At least one sort column is required; the step fails if none is selected, or if a selected column is not present in the data at that point in the pipeline.
Sorting changes only row order — no rows are added, removed or recalculated.
Sorting matters when a later step depends on row order, such as [Data snapshot](/steps/data-snapshot) or [Publish dataset](/steps/publish). It does **not** affect group or rolling-window functions in [Calculate Variable](/steps/calculate-variable), which resolve their own ordering by date and entity.
To place rows in an explicit, arbitrary sequence rather than sorting by value, use the **Reorder Rows** step instead.
## Next steps
Drop rows that don't meet a condition.
Change column order rather than row order.
# Create a Table
Source: https://learn.alphacast.io/steps/table-view
Render pipeline output as a formatted table that can be embedded in a dashboard.
The **Create a Table** step renders the data as a table, ready to include in a dashboard. It is an output step: the data passes through unchanged to any steps that follow.
## Configuration
| Field | Description |
| - | - |
| Columns | The columns to show. Leave empty to include all of them. |
Column order in the table follows the order of the data reaching the step, so put a [Reorder Columns](/steps/reorder-columns) step before it if you need a specific layout. Row order works the same way — see [Sort Rows](/steps/sort-rows) and [Reorder Rows](/steps/reorder-rows).
The rendered table image is cached. Rerunning the step clears the cache so the dashboard picks up the new data rather than serving a stale image.
## Next steps
Render the same data as a chart.
Combine several charts and tables with shared filters.
# Technical Analysis
Source: https://learn.alphacast.io/steps/talib
Estimate 132 technical analysis metrics on financial assets — momentum, volatility, volume, overlap studies and pattern recognition.
The **Technical Analysis** step estimates 132 metrics for the technical analysis of financial assets, drawn from TA-Lib and grouped into eight families.
## How to use it
Most metrics need open, close, high, low and volume variables to work properly. You can load these directly with [Fetch Yahoo Finance](/steps/fetch-yahoo).
Select the function group, the function, its parameters and an optional prefix, then press save. The new variables are added to the dataset.
## Function groups
Pick a group first, then a function within it. Each function exposes its own parameters, prefilled with TA-Lib defaults.
| Group | Functions | Examples |
| - | - | - |
| Pattern Recognition | 61 | `CDLDOJI`, `CDLENGULFING`, `CDLABANDONEDBABY`, `CDL3BLACKCROWS` |
| Momentum Indicators | 30 | `RSI`, `MACD`, `ADX`, `AROON`, `APO` |
| Overlap Studies | 17 | `SMA`, `EMA`, `BBANDS`, `SAR`, `KAMA` |
| Statistic Functions | 9 | `BETA`, `CORREL`, `LINEARREG`, `STDDEV` |
| Cycle Indicators | 5 | `HT_DCPERIOD`, `HT_DCPHASE`, `HT_SINE`, `HT_TRENDMODE` |
| Price Transform | 4 | `AVGPRICE`, `MEDPRICE`, `TYPPRICE`, `WCLPRICE` |
| Volatility Indicators | 3 | `ATR`, `NATR`, `TRANGE` |
| Volume Indicators | 3 | `AD`, `ADOSC`, `OBV` |
Each function's output columns are named after the indicator and prefixed with whatever you enter in the **prefix** field, so you can run the same indicator more than once with different parameters.
The complete function list, with a plain-language description and default parameters for each, is in the group and function dropdowns of the step itself.
[This example dataset](https://www.alphacast.io/datasets/18042) contains every metric estimated for AAPL.
## Next steps
Build tear sheets and rolling performance stats.
Load the price data these metrics need.
# Apply Transform
Source: https://learn.alphacast.io/steps/transform
Apply prebuilt economic transformations — year-over-year change, constant prices, per capita, % of GDP, seasonal adjustment and currency conversion.
The **Apply Transform** step applies prebuilt transformations to the data, and lets you combine several at once.
The options available depend on the **frequency of the input data**. A daily dataset offers rolling-window transforms; a monthly one offers seasonal adjustment and sum-last-12-months; a yearly one offers neither. Every frequency includes **Original Variable**, which keeps the untransformed column alongside the transformed ones.
Some transformations need reference data that Alphacast supplies automatically — inflation indices for constant prices, population for per capita, GDP series for % of GDP, and exchange rates for currency conversion. These require the dataset to carry a country entity so the right reference series can be matched.
Each transformation adds a new column named after the original plus the transformation's internal key — `EMBI Global Diversified Subindices - 30d_change`. The original column is kept, so you can apply several transformations to the same variable and compare them side by side.
| Transformation | What it does |
| - | - |
| **1 day change** | Change against the previous day. |
| **7 days change** | Change against the same day one week earlier. |
| **7 days average** | Rolling mean over the last 7 days. |
| **30 days change** | Change against the same day 30 days earlier. |
| **30 days average** | Rolling mean over the last 30 days. |
| **30 days average - Month over Month** | Monthly change of the 30-day rolling mean. |
| **30 days sum** | Total over the last 30 days. |
| **Month to Date Change** | Change from the start of the current month to date. |
| **Month to Date Sum** | Total from the start of the current month to date. |
| **Year to Date Change** | Change from the start of the current year to date. |
| **Year to Date Sum** | Total from the start of the current year to date. |
| **Currency conversion LCU / USD - daily** | Converts local currency units to US dollars. |
| **Currency conversion BCS / USD** | Argentina only. |
| Transformation | What it does |
| - | - |
| **Year over Year** | Change against the same month one year earlier. |
| **Month over Month** | Change against the previous month. |
| **Year over Year - 3 months moving average** | Year-over-year change of the 3-month moving average. |
| **12 months average** | Rolling annual mean. |
| **Sum last 12 months** | Total over the previous twelve months. |
| **Sum last 12 months - Year over Year** | Year-over-year change of that rolling total. |
| **Sum last 12 months - Month over Month** | Monthly change of that rolling total. |
| **Sum last 12 months - % of GDP** | The rolling annual total as a share of GDP. |
| **% of GDP** | The variable as a share of Gross Domestic Product. |
| **Constant prices** | Removes the effect of inflation. |
| **Constant prices - Year over Year** | Year-over-year change in real terms. |
| **Constant prices - Month over Month** | Monthly change in real terms. |
| **Constant prices - Year over Year - 3 months moving average** | Real year-over-year change of the 3-month moving average. |
| **Seasonally adjusted** | Removes seasonal variation. |
| **Seasonally adjusted - Month over Month** | Monthly change of the seasonally adjusted series. |
| **Constant prices - Seasonally adjusted** | Both adjustments combined. |
| **Constant prices - Seasonally adjusted - Month over Month** | Monthly change of the real, seasonally adjusted series. |
| **Per Capita** | Divided by the country's population. |
| **Constant prices - Per Capita** | Per capita in real terms. |
| **Year to Date Change** / **Year to Date Sum** | From the start of the current year to date. |
| **Currency conversion LCU / USD - monthly** | Converts to US dollars. |
| **Currency conversion BCS / USD** | Argentina only. |
| Transformation | What it does |
| - | - |
| **Year over Year** | Change against the same quarter one year earlier. |
| **Quarter over Quarter** | Change against the previous quarter. |
| **Sum last 4 quarters** | Total over the previous four quarters. |
| **4 quarters average** | Rolling mean over the last four quarters. |
| **% of GDP** | The variable as a share of Gross Domestic Product. |
| **Constant prices** | Removes the effect of inflation. |
| **Constant prices - Year over Year** | Year-over-year change in real terms. |
| **Seasonally adjusted** | Removes seasonal variation. |
| **Seasonally adjusted - Quarter over Quarter** | Quarterly change of the seasonally adjusted series. |
| **Per Capita** | Divided by the country's population. |
| **Constant prices - Per Capita** | Per capita in real terms. |
| **Year to Date Change** / **Year to Date Sum** | From the start of the current year to date. |
| **Currency conversion LCU / USD - quarterly** | Converts to US dollars. |
| **Currency conversion BCS / USD** | Argentina only. |
| Transformation | What it does |
| - | - |
| **Year over Year** | Change against the previous year. |
| **Constant prices** | Removes the effect of inflation. |
| **Constant prices - Year over Year** | Year-over-year change in real terms. |
| **% of GDP** | The variable as a share of Gross Domestic Product. |
| **% of Current USD GDP** | As a share of GDP measured in current US dollars. |
| **Per Capita** | Divided by the country's population. |
| **Constant prices - Per Capita** | Per capita in real terms. |
| **Currency conversion LCU / USD** | Converts to US dollars. |
| **Currency conversion BCS / USD** | Argentina only. |
For seasonal adjustment with control over the underlying model — including trend and irregular components — use the **X13 ARIMA Seasonal Adjustment** step rather than the prebuilt **Seasonally adjusted** transformation.
Country-specific unit conversions are also available on their own through the **Apply Country Transform** step. If none of the prebuilt options fit, [Calculate Variable](/steps/calculate-variable) lets you write the transformation yourself — see the [formula reference](/steps/formula-reference).
## Next steps
Write custom formulas when a prebuilt transform doesn't fit.
Resample first to unlock frequency-specific transforms.
# Unstack (Long to Wide)
Source: https://learn.alphacast.io/steps/unstack-dataset
Pivot a long-format dataset to wide format, turning the values of an entity column into columns of their own.
Sooner or later you find the data you need, but not in the shape you need it — values that should be columns are rows, or the other way round. Transposing doesn't fix it, because the entity columns have to be preserved. **Unstack** and [Melt](/steps/melt-dataset) do.
**Unstack** goes from long to wide: the values of an entity column become new columns.
## Example
Start with some Yahoo Finance data. The tickers (Apple, Microsoft, Google and so on) are values inside a single `Ticker` column. Suppose you need them side by side as columns, and only want the closing price rather than open-high-low-close.
Each ticker now has its own column.
See the [example pipeline](https://www.alphacast.io/pipelines/2022-6-10-UYhLlh/view) for both directions in one place.
## Reversing it
To go back the other way, use [Melt (Wide to Long)](/steps/melt-dataset).
## Next steps
The inverse operation.
Join the reshaped data with another dataset.
# The Dataset Manifest
Source: https://learn.alphacast.io/uploading/manifest
How to define column types, entity columns, date format, and renames in the dataset manifest that drives every Alphacast upload.
The manifest is the column schema attached to a dataset. It tells Alphacast how to interpret every column in an uploaded CSV: which one carries the date, which ones identify a row, which ones hold measurements, and what type each column has. Every upload validates the incoming file against the manifest, so getting the manifest right is the single most important step before pushing data.
The manifest is stored on the dataset and reused on every upload until you replace it. You can supply it via the `manifest` form field on `PUT /datasets/{id}/data`, or configure it from the Alphacast web UI.
## Manifest shape
A manifest is a JSON array of column definitions. Each element describes one column:
```json theme={null}
[
{ "sourceName": "Date", "dataType": "Date", "isEntity": true },
{ "sourceName": "Country", "dataType": "String", "isEntity": true },
{ "sourceName": "GDP_USD", "dataType": "Decimal", "isEntity": false, "destinationName": "GDP" },
{ "sourceName": "Year", "dataType": "Short Integer", "isEntity": false },
{ "sourceName": "Notes", "dataType": "String", "isEntity": false },
{ "sourceName": "Internal", "ignore": true }
]
```
## Column fields
The exact column name as it appears in the **CSV header row**. Whitespace at the edges is trimmed automatically; embedded newlines are converted to spaces. Comparison against the CSV header is case-insensitive and accent-insensitive (`País` matches `pais`), so minor casing inconsistencies in the source file are tolerated — Alphacast normalizes the column to the manifest's canonical name.
The data type for this column. One of:
* `Date` — a date value, parsed using the dataset's [date format](#date-format). There must be exactly **one** `Date` column in the manifest, and it acts implicitly as an entity column.
* `String` — text or categorical value. Used for both **entity** dimensions (e.g. `Country`) and **value** strings (e.g. `Notes`).
* `Decimal` — numeric value with arbitrary precision. The default for any value column that is not explicitly String or Short Integer.
* `Short Integer` — an `Int16` integer (range −32,768 to 32,767). Use this only when you know every value fits — uploads fail with `Column 'X' cannot be cast to Short Integer (Int16)` if any row exceeds the range.
Whether the column is part of the row identity (a dimension) or a measurement.
* `true` — **entity column**. Together with the `Date` column, entity columns form the **composite key** Alphacast uses to match rows during merges. Typical entities: `Country`, `Sector`, `Ticker`, `Region`.
* `false` — **value column**. Holds the actual measurements that get inserted, updated, or deleted.
The `Date` column is always treated as an entity, even though it has its own `dataType: "Date"`.
Optional. If provided, Alphacast renames the column from `sourceName` to `destinationName` before applying any other logic. Useful when the upstream file uses a different name from the one you want to expose in Alphacast (e.g. CSV column `GDP_USD_Billions` → dataset column `GDP`).
Optional. When `true`, Alphacast drops the column from the upload before validation. Use this for ad-hoc columns in the CSV that you do not want to import.
## Entity vs value columns
Understanding the entity / value split is the key concept of the manifest:
* **Entity columns** identify a row uniquely. Two rows with the same `Date` + same combination of entity values represent the same observation. If your CSV contains two rows with `Date = 2024-01-01, Country = USA`, the upload fails with a duplicate-rows error.
* **Value columns** hold the data that changes between observations. When the same entity key appears in both the upload and the existing dataset but a value column differs, Alphacast treats that as a **conflict** and resolves it according to your [upload modes](/uploading/validation#upload-modes).
Empty values in entity columns are filled with the literal string `'none'` so they still participate in the composite key. Entity values are also stripped of surrounding whitespace.
## The date column
Exactly one column should have `dataType: "Date"` and `isEntity: true`. This column drives:
* The dataset's `minDate` and `maxDate` metadata.
* The inferred `frequency` (`D`, `M`, `Q`, `A`, or `null` if Alphacast cannot detect a regular cadence).
* Date-range optimizations during merges — historical rows outside the upload's date window are preserved without comparison, which keeps incremental uploads fast.
### Date format
Each dataset has a `date_format` property — a Python `strftime` string such as `%Y-%m-%d`, `%d/%m/%Y`, or `%Y-%m`. Every value in the date column must match this format, or the upload fails with `Date should be formatted as `.
Alphacast tries the configured format first, then a lowercased variant, and finally splits on whitespace and tries again (so timestamps like `2024-01-01 00:00:00` parse against a `%Y-%m-%d` format). Anything still unrecognized is rejected.
If your source data has a fixed but non-ISO format (for example, `%d/%m/%Y` from a Latin American statistical agency), set the dataset's date format **once** and let every upload use it directly — there is no need to pre-process dates client-side.
## Numeric type inference
For value columns marked as `Decimal`, Alphacast does not require pre-cleaned numbers. The processor:
1. Strips a trailing `%` and remembers it (so `12.5%` becomes `0.125`).
2. Tries an English-number parse (`1,200.50` → `1200.5`).
3. Falls back to a continental-Europe parse (`1.200,50` → `1200.5`).
4. Picks whichever interpretation parses cleanly — and if at least **80%** of the column's non-null values are numeric, the column is accepted as `Decimal`. Otherwise it is downgraded to `String` automatically.
This means you can usually upload raw CSVs from spreadsheets without sanitizing the numbers. The exceptions are:
* **`Short Integer`** columns: there is no fallback. Every value must fit in `Int16` after parsing, or the upload fails.
* Columns with mixed numeric and non-numeric content where the numeric share is below 80%: they will silently become strings, which is rarely what you want. Inspect the process's `stats.entitiesCount` and column types after the first upload to confirm the inference.
## Manifest locking
A dataset can have its manifest **locked** (`manifestLocked = true`). When locked:
* The `manifest` form field on uploads is **ignored** — the dataset's existing manifest is the only one used.
* `deleteMissingFromDB` is forced to `false` regardless of what you pass.
* `acceptNewColumns` is forced to `false` regardless of what you pass.
Locking is a safety mechanism for production datasets where the schema must not drift. Unlock it from the Alphacast web UI before changing the manifest.
## Renaming and ignoring columns: a worked example
Suppose your CSV looks like this:
```csv theme={null}
Fecha,País,PIB_USD_Mil_Millones,Notas_Internas,Categoría
2024-01-01,Argentina,621.4,reviewed,Economy
2024-01-01,Brasil,2173.7,pending,Economy
```
And your dataset uses English column names with `Notas_Internas` excluded:
```json theme={null}
[
{ "sourceName": "Fecha", "destinationName": "Date", "dataType": "Date", "isEntity": true },
{ "sourceName": "País", "destinationName": "Country", "dataType": "String", "isEntity": true },
{ "sourceName": "PIB_USD_Mil_Millones", "destinationName": "GDP_USD_Billions", "dataType": "Decimal", "isEntity": false },
{ "sourceName": "Notas_Internas", "ignore": true },
{ "sourceName": "Categoría", "destinationName": "Category", "dataType": "String", "isEntity": false }
]
```
After the upload, the dataset has columns `Date`, `Country`, `GDP_USD_Billions`, `Category`. The original CSV column names never appear anywhere downstream.
## What's next
The validation rules every upload runs through, plus the three flags that control conflict resolution.
Request shape, form fields, error codes, and code samples for `PUT /datasets/{id}/data`.
# Uploading Data: Overview
Source: https://learn.alphacast.io/uploading/overview
How dataset uploads work in Alphacast — the manifest, the upload lifecycle, and what to expect after a CSV is processed.
Alphacast stores tabular data in **datasets**, which live inside repositories. To put rows into a dataset, you upload a CSV (plain or gzip-compressed) through the [`PUT /datasets/{id}/data`](/api/datasets/upload) endpoint. The upload is processed asynchronously by a background job that validates the file, merges it with existing data, and updates the dataset's column schema, date range, and inferred frequency.
This section explains every requirement before, during, and after an upload — what the manifest is, why it matters, what gets validated, and how the merge logic decides whether to insert, update, or delete rows.
Looking for the API reference? See [`PUT /datasets/{id}/data`](/api/datasets/upload) for the request shape, parameters, and example payloads. The pages in this section explain the **concepts** behind those parameters.
## Before you upload: initialize the dataset
A dataset must already exist and have a **manifest** before its first upload. The manifest is the column schema that tells Alphacast what every column in your CSV means: which one carries the date, which ones identify a row (entities), which ones hold the actual measurements, and what data type each column has.
There are two ways to provide a manifest:
1. **In the upload request itself** — pass a `manifest` form field on the first `PUT /datasets/{id}/data` call. Alphacast saves the manifest against the dataset and uses it for that upload and all subsequent ones (until you replace it).
2. **From the Alphacast web UI** — open the dataset and configure its columns visually before any upload happens.
If you call `PUT /datasets/{id}/data` without a manifest **and** the dataset has never had one, the upload fails with `Dataset has no manifest`. The next page covers the [manifest schema](/uploading/manifest) in detail.
## The upload lifecycle
Every upload creates an **upload process** record that moves through four states:
The API receives your `PUT /datasets/{id}/data` request, validates basic permissions, stores the CSV in temporary cloud storage, and returns a process object with an `id` and `status: "Requested"`. The HTTP call returns immediately — the actual processing happens in the background.
A background worker picks up the request. Only **one process per dataset** can run at a time. If another upload for the same dataset is already in flight, the new request waits in `Requested` until the in-flight job finishes.
During processing, Alphacast:
* Loads the CSV from storage and applies the manifest (rename, ignore columns).
* Runs every [validation rule](/uploading/validation).
* Compares the incoming rows with the dataset's existing rows by their entity key.
* Computes the final dataset using the [conflict-resolution flags](/uploading/validation#upload-modes) you passed.
* Writes the merged dataset back to storage and updates the dataset's metadata (date range, inferred frequency, last-edited timestamp).
The upload completed successfully. The process's `stats` field is populated with row counts (`insertedValues`, `updatedValues`, `deletedValues`, `changedValues`, `totalValues`, `minDate`, `maxDate`, etc.) and a `statusDescription` summarizing what happened. Subscribers to the dataset receive a notification (rate-limited to one per dataset per four hours).
Validation failed or processing raised an exception. The `statusDescription` field contains the error message — for example, `Data has not Date column`, `Entity column 'Country' has empty values`, or `42 rows are duplicated`. Fix the CSV (or the manifest) and retry.
The `stats` field on the process record is the source of truth for what changed. After a successful upload, fetch the process by ID to see the row-level breakdown — useful for logging, alerting, or building your own upload dashboard.
## Idempotency: identical content is skipped
If you upload the **exact same content** with the **exact same parameters** (`manifest`, `deleteMissingFromDB`, `onConflictUpdateDB`) as the most recent successful upload, Alphacast detects this via a content hash and skips the merge entirely. The process is still recorded, but with `skippedReason: "identical_content"` and zero inserts/updates/deletes.
This makes scheduled re-uploads safe and cheap — pushing the same file every hour from a cron job will not generate spurious change notifications or re-write storage.
## File formats
| Format | Extension | Notes |
| - | - | - |
| Plain CSV | `.csv` | First row must be the header. UTF-8 or latin1 encoding. |
| Gzip-compressed CSV | `.csv.gz` | Same content as plain CSV, gzip-encoded. Reduces upload time for large files. |
The upload endpoint accepts the file as a `multipart/form-data` field named `data`. Anything else in the form (such as the `manifest` JSON string) is treated as a parameter, not file content.
## What you'll find in this section
Column definitions: entity vs value columns, data types, date format, ignored and renamed columns, manifest locking.
Every validation rule the processor enforces, plus the three flags that control how new data is merged with existing rows.
# Validation Rules and Upload Modes
Source: https://learn.alphacast.io/uploading/validation
Every validation rule Alphacast runs against an uploaded CSV, and how the deleteMissingFromDB / onConflictUpdateDB / acceptNewColumns flags control row-level conflict resolution.
Once the [manifest](/uploading/manifest) is in place, every upload runs through a fixed sequence of validations, then applies the merge logic governed by three flags. This page documents both — what causes an upload to fail, and what happens to each row when it succeeds.
## Validation rules
The processor runs these checks in order. The first failure aborts the upload and records the error message in the process's `statusDescription`.
### 1. Date column must exist and parse
If the manifest declares a date column, the CSV must contain it. Every value must parse against the dataset's configured date format.
| Failure | Error message |
| - | - |
| Missing date column | `Data has not Date column` |
| Unparseable date | `Date should be formatted as ` |
Alphacast tries the configured format, then a lowercased variant, then splits on whitespace and retries — so `2024-01-01 00:00:00` parses fine against `%Y-%m-%d`.
### 2. All entity columns must exist
Every column with `isEntity: true` in the manifest must appear in the CSV header.
| Failure | Error message |
| - | - |
| Missing entity column | `Data has not required '' column. If you need to change entities, please specify new entitiesColumnNames during upload` |
### 3. The CSV must not be empty
| Failure | Error message |
| - | - |
| Empty file | `Data is empty` |
A header-only CSV with zero data rows counts as empty.
### 4. Entity columns must not contain null values
After Alphacast strips whitespace from entity values, every entity column must have a value on every row. Empty cells are first replaced by the literal string `'none'`, but if a value is genuinely missing — for example, NaN propagated from a prior calculation — the upload fails.
| Failure | Error message |
| - | - |
| Null in entity column | `Entity column '' has empty values` |
### 5. New columns require explicit opt-in
If the CSV contains columns the dataset has never seen before **and** the dataset already has a manifest from a prior upload **and** you did not pass `acceptNewColumns=true`, the upload fails.
| Failure | Error message |
| - | - |
| Unknown column without opt-in | `Unknown column(s): X. Missing column(s): Y - consider renaming to original names or add 'AcceptNewColumn' parameter to confirm adding new column(s)` |
To add columns intentionally, pass `acceptNewColumns=true`. To rename a column instead, use the manifest's `destinationName` field — see [Manifest](/uploading/manifest#column-fields).
### 6. Column names must be unique (case-insensitive)
After Alphacast normalizes column names (lowercases, removes whitespace, strips accents), no two columns may collide.
| Failure | Error message |
| - | - |
| Duplicate columns | `Duplicated columns: ` |
Watch out for `gdp` vs `GDP`, or `País` vs `Pais` — both pairs collide.
### 7. No duplicate rows by entity key
Two rows with the same combination of entity-column values (including the date column) are treated as duplicates. The upload fails and reports the count plus the first ten offending key combinations.
| Failure | Error message |
| - | - |
| Duplicate rows | ` rows are duplicated. First 10 rows as example: [...]` |
If your data legitimately has multiple measurements per `Date + Country`, you need an additional entity column (e.g. `Sector` or `Source`) to disambiguate them.
### 8. Short Integer values must fit Int16
Columns marked `Short Integer` in the manifest must hold values in the `[-32768, 32767]` range. Decimals, NaNs after coercion, or out-of-range integers all fail.
| Failure | Error message |
| - | - |
| Out-of-range Short Integer | `Column '' cannot be cast to Short Integer (Int16): ` |
For values larger than 32,767, use `Decimal` instead.
### 9. Decimal columns need ≥80% numeric content
Columns declared `Decimal` go through automatic numeric inference (handles `1,200.50`, `1.200,50`, `12.5%`). If fewer than 80% of non-null values parse as numeric, Alphacast silently downgrades the column to `String`. There is no error in this case, but the column won't behave as a measurement — inspect the column types after the first upload to catch this.
## Upload modes
Once validation passes, the processor merges the new rows with the existing dataset. Three flags on the request control the merge behavior:
### `acceptNewColumns`
| Value | Behavior |
| - | - |
| `false` (default) | Columns in the CSV that are not in the manifest cause the upload to fail (validation rule 5). |
| `true` | Unknown columns are added to the dataset's schema. Use this when you intentionally extend a dataset. |
`acceptNewColumns` is forced to `false` when the [manifest is locked](/uploading/manifest#manifest-locking).
### `deleteMissingFromDB`
| Value | Behavior |
| - | - |
| `false` (default) | Rows present in the dataset but **missing** from the upload are kept untouched. Use this for incremental uploads that only add or update recent data. |
| `true` | Rows present in the dataset but missing from the upload are **deleted**. Use this when the upload is the new authoritative state of the dataset (a full replace). |
`deleteMissingFromDB=true` permanently deletes any existing row whose entity key does not appear in the upload. Verify your CSV contains every row you want to keep before setting this flag.
`deleteMissingFromDB` is forced to `false` when the manifest is locked.
### `onConflictUpdateDB`
A **conflict** is a row whose entity key matches an existing row but where at least one value column differs.
| Value | Behavior |
| - | - |
| `false` (default) | Conflicts are resolved by **keeping the existing value** in the dataset. The upload's value is discarded for those rows. |
| `true` | Conflicts are resolved by **overwriting the existing value** with the upload's value. Use this when the upload is meant to be the latest correct version of the data. |
If more than 10% of values changed during a conflicting upload, the process appends a warning to `statusDescription` (`WARNING: More than 10% of values changed. This may indicate a problem with the data.`).
## How the three flags combine
| Scenario | `acceptNewColumns` | `deleteMissingFromDB` | `onConflictUpdateDB` | Result |
| - | - | - | - | - |
| Add fresh data, never overwrite | `false` | `false` | `false` | Append-only. New rows are inserted; existing rows are never touched. |
| Update recent values | `false` | `false` | `true` | Inserts new rows, updates existing rows with new values, leaves old rows alone. |
| Full replacement | `false` | `true` | `true` | Dataset becomes exactly what the upload contains. |
| Add a new column to an existing dataset | `true` | `false` | `false` | Same as scenario #1 but allows the schema to grow. |
| Restore a backup that should not change unrelated rows | `false` | `false` | `false` | Safe default: nothing existing is overwritten or deleted. |
## What you get back: process stats
After every successful upload, the process record's `stats` field contains the row-level breakdown:
| Field | Meaning |
| - | - |
| `rows` | Rows in the uploaded CSV (after manifest renames and ignores). |
| `columns` | Columns in the uploaded CSV (after manifest renames and ignores). |
| `minDate`, `maxDate` | Date range of the upload. |
| `entitiesCount` | Object with the number of distinct values per entity column. |
| `insertedValues` | Cell-level count of values added to the dataset. |
| `updatedValues` | Cell-level count of values overwritten (only when `onConflictUpdateDB=true`). |
| `deletedValues` | Cell-level count of values removed (only when `deleteMissingFromDB=true`). |
| `changedValues` | Conflicts detected, regardless of resolution. |
| `missingValues` | Cell-level count of values present in the dataset but missing from the upload. |
| `preservedHistoricalRows` | Rows outside the upload's date range, kept without comparison (an optimization for incremental uploads). |
| `finalRows`, `finalColumns` | Final shape of the dataset after the merge. |
| `versionId` | S3 version ID of the new dataset snapshot. Use this for point-in-time downloads. |
| `contentHash` | MD5 of the upload's normalized content. Identical hashes against the same flags trigger the [skip-on-identical optimization](/uploading/overview#idempotency-identical-content-is-skipped). |
If the upload failed, `stats` may be empty and the error appears in `statusDescription` instead.
## What's next
Define columns, types, the date format, renames, and ignored columns.
Endpoint, parameters, code samples, and HTTP status codes.