Skip to main content

Saved SQL

Base: /v1/saved-sql-queries. Authenticate with an API key:
Saved queries appear on the device function list as saved.<uuid> and are always executed with read-only SQL policy. Invoke accepts no client input (SQL stays server-side).

Validate before save

POST /v1/devices/{device_id}/functions/sicarv4.custom.validate checks the SQL on an enrolled device and does not store it. Use it before POST /v1/saved-sql-queries. Scope: functions.invoke.
200 with data.result.ok: true means the tables resolved and, for a SELECT, the zero-row probe succeeded. Mutating SQL is 400 and is never saved. ok: false means the device rejected the statement (schema_error / explain_error).

Create saved query

Get saved query

200 response (SQL is decrypted server-side):

List with filters

When device_id is set, returns queries scoped to that device plus global queries (device_id IS NULL). Response: { data: Query[], meta }. Optional page / per_page (max 100); omit both for the full set.

Delete saved query

200 response: