Overview
When you define a dataset insquirrels.yml, Squirrels automatically creates dedicated API endpoints for that dataset. These endpoints allow clients to:
- Query parameter definitions and options
- Retrieve dataset results based on parameter selections
- Access data according to the dataset’s permission scope
Configuration in squirrels.yml
Datasets are configured in thedatasets section of your squirrels.yml file:
squirrels.yml
API endpoints
There is a data catalog endpoint to discover datasets. Also, each configured dataset gets its own permissioned endpoints:- Dataset parameters: used to render widgets and handle cascades
- Dataset results: used to retrieve the tabular result
API prefix
Most dataset-related endpoints are rooted under a project-specific prefix constructed by the API server:sqrl_major_version: The Squirrels framework major version (from the running server)project_name: Your project name normalized for URLsproject_version:v{major_version}fromsquirrels.yml(project_variables.major_version)
{api_prefix} to refer to this full prefix.
Data catalog endpoint
Before calling any dataset endpoints, a client can fetch the project’s data catalog to discover:- Which parameters exist and what their current defaults/options are
- Which datasets (and dashboards) are available to the current user, and the parameters they use
- The exact
parameters_pathandresult_pathfor each dataset
parameters list. For select parameters, each parameter includes a trigger_refresh boolean that tells the client whether changing the selection should trigger a parameters refresh request.
Dataset parameters endpoint
- Full parameters: If you provide no widget selections, it returns all dataset parameters.
- Refresh/update: If you provide a selection for a parent parameter (typically one whose definition has
trigger_refresh: true), the response will include only the parent parameter and its dependent parameter(s), with options updated based on the selection.
Dataset results endpoint
GET vs POST requests
Dataset parameters/results endpoints support both GET and POST. They are semantically equivalent - the difference is how you provide selections:- GET: selections are sent as URL query parameters
- POST: selections are sent as a JSON request body
- Use GET for simple selections.
- Prefer POST when selections are complex and the URL might become large.
In addition to your project’s widget parameter names, Squirrels defines a small set of
x_* request fields. These are not widget parameters - they control request behavior (output orientation, offset, limit, etc). See the “Available request fields (per endpoint)” section below for more details.Available request fields (per endpoint)
This section lists the supported request fields (query/body) and the relevant headers for each endpoint.Get data catalog
Get data catalog
Authorization: Bearer <token>- Required if auth is enabledx-api-key: <api_key>- Alternative toAuthorization
Get dataset parameters
Get dataset parameters
squirrels.yml), provided as query parameters (GET) or JSON body fields (POST).Special x_* request fieldsx_parent_param(string) - The parent parameter name used for parameter updates. If provided, only selections for this parameter are used for cascading, and others are ignored.
Authorization/x-api-key- Authentication
The parameters endpoint behavior depends on the presence of
x_parent_param and widget selections:- If
x_parent_paramis provided: Only the widget selection(s) matching the value ofx_parent_paramare used to identify the selections for cascading. All other widget selections are ignored. If no query parameters match thex_parent_paramvalue, the selection is assumed to be an empty list. - If
x_parent_paramis NOT provided:- If selections for multiple parameters are provided, an error is raised.
- If selection(s) for one parameter is provided, it is automatically treated as the parent parameter.
- If no widget selections are provided, all the dataset’s parameters are returned.
Get dataset results
Get dataset results
squirrels.yml), provided as query parameters (GET) or JSON body fields (POST).Special x_* request fieldsx_sql_query(string, optional) - Optional Polars SQL to transform the final dataset (use table nameresult)x_orientation(string, defaultrecords) - Controls result orientation. Options arerecords(default),rows, andcolumns.x_offset(int, default0) - Number of rows to skip before returning datax_limit(int, default1000) - Max rows to return
Authorization/x-api-key- Authenticationx-config-{name}: <value>- Configurable overrides (only applied for users with elevated privileges, and only for configurables defined in the project)
The
x_sql_query uses Polars SQL instead of DuckDB SQL (or other query engines like SQLite) for two main reasons:- Security: Polars SQL is more secure than DuckDB SQL for custom SQL queries provided by the user. It lacks security vulnerabilities like file access and extensions. Additional guardrails are also set on the SQL query such as time limit and permitted clauses.
- Performance: Dataset results are loaded into Python memory as a Polars DataFrame before sending to the client. Using Polars SQL avoids the need to load the dataset result into DuckDB before querying it and loading the result back to Python memory.
/project/{project_name}/v{project_version}/docs.
Example client workflow
A typical API client flow might look like this:- Get the data catalog to discover datasets and parameters
- Use the
trigger_refreshfield from the catalog’s parameter definitions to determine which parameter changes require refresh calls - Call the dataset parameters endpoint (as needed) to refresh dependent parameters for any parent parameter where
trigger_refresh: true - Call the dataset results endpoint to retrieve the tabular dataset result for the selected values
Related pages
- Project configs (squirrels.yml) - Complete reference for dataset configuration
- Data models - Understanding the different types of data models
- Cascading parameter options - How parameters filter based on selections
- Virtual Data Lake (VDL) - Where build models are stored
- sqrl run - CLI reference for running the API server