Data lake
Create saved query
Save a lake SQL query with a fixed or rolling date range.
POST
A saved query is lake SQL you store on an instance so you can rerun it later. It is not a query run. Saving does not execute the SQL. After you save it, run it with Create new query by sending
saved_query_id, or attaching a schedule.
A saved query stores SQL only. You cannot create one with
resource and filters, and you cannot update an existing saved query to filters later. Use Create new query when you want to query with filters.Authorization
Blnk Cloud APIs support any one of the following authentication methods. All of them work with yourCLOUD_API_KEY or OAUTH_ACCESS_TOKEN.
- Bearer token
- X-Blnk-Key header
- X-API-Key header
Body
string
required
Unique id of the instance (
instance_...). Get it from get instance details. Do not pass deployment_id.string
required
Label shown in Insights and copied onto query runs that come from this query. Maximum 160 characters.
string
Optional note about what the query returns. Maximum 1000 characters.
string
required
One read-only DuckDB
SELECT or WITH statement Cloud will run each time you execute this query. Same table and statement rules as Create new query.string
required
How Cloud picks the lake date range when the query runs.
fixed uses start_date and end_date on every run. rolling uses the last rolling_days days, resolved at run time.string
First day of lake history. Required when
range_mode is fixed. ISO date (2026-08-01) or datetime. Omit it for rolling queries.string
Last day of lake history. Required when
range_mode is fixed. Must be after start_date. Omit it for rolling queries.integer
Required when
range_mode is rolling. Number of days of lake history Cloud opens when the query runs (1 to 3650). Cloud resolves the window at run time: UTC for a manual run, or the schedule timezone when a schedule fires.For example, 30 opens the last 30 days. A manual run on 16 September 2026 (UTC) opens 2026-08-18 through 2026-09-16. Omit it for fixed queries.Response
string
Unique id of this saved query (
lake_query_...). Pass it as saved_query_id on Create new query.string
Unique id of the instance (
instance_...) this query is bound to.string
User who created the query. Anyone in the workspace can run it. Only this owner or an admin can update, delete, or schedule it.
string
Label shown in Insights and copied onto query runs that come from this query.
string
Note you sent about what the query returns, or an empty string if you omitted it.
string
Read-only DuckDB
SELECT or WITH Cloud stored. Cloud runs this statement each time you execute the query.string
How Cloud picks the lake date range when the query runs:
fixed or rolling.timestamp
First day of lake history for a
fixed query. Omitted when range_mode is rolling.timestamp
Last day of lake history for a
fixed query. Omitted when range_mode is rolling.integer
Number of days of lake history to open when
range_mode is rolling. 0 when the query is fixed.timestamp
When Cloud created this saved query.
timestamp
When the saved SQL, name, description, or date range was last changed. Same as
created_at on a new query.