Snowflake API Orchestration Layer
All templates

Snowflake API Orchestration Layer

Put a governed API contract in front of Snowflake. Apps call clean REST endpoints instead of raw SQL — with shared-secret access control, input validation, a 15-minute read-through cache, audit logging, and one normalized response envelope across all queries.

Start building in Xano: Access the prompt at https://go.xano.co/start-xano-with-template-skill and run it here with orchestration-layer-snowflake as your template.
ClaudeOpenAI CodexCursorVS Code

Copy and paste the prompt in your local coding agent of choice.

Template Details

3 Tables 4 APIs 11 Functions

Integrations

Snowflake
Template Preview
Client appClient appWeb · mobile · agentsnowflake_orchestration APIsnowflake_orchestrationAPIcustomers/{customer_id}/profilecustomers/searchmetrics/revenue-summaryBusiness logicBusiness logicSnowflake orchestration cach...Snowflake orchestration cach...Snowflake orchestration chec...Snowflake orchestration enve...Snowflake orchestration log ...Snowflake orchestration quer...Snowflake orchestration quer...+2 moreDataDataapi_request_logscached_query_resultsquery_audit_logsExternal servicesExternal services Snowflake

Overview

Put a governed API contract in front of Snowflake. Apps call clean REST endpoints instead of raw SQL — with shared-secret access control, input validation, a 15-minute read-through cache, audit logging, and one normalized response envelope across every query.

Snowflake stays the source of truth for the data; Xano owns the API contract, the access control, and the caching. Push it and three governed endpoints sit in front of your warehouse — the validation, caching, auth, and envelope logic run immediately; wiring your Snowflake account turns on the live queries.

What it provides

The moment more than one app needs warehouse data, "just give it a Snowflake connection" stops being safe. Every client re-implements the same query, there's no shared access control, no caching (so the warehouse — and the bill — takes every read), and each app shapes the response differently. The logic and the governance end up smeared across clients instead of living in one place.

This template is that one place. Three read endpoints wrap parameterized Snowflake queries behind a single API group: a shared secret gates access, inputs are validated before a query runs, results are cached read-through for 15 minutes (so repeat reads never touch Snowflake), every call is audited, and every response comes back in one normalized envelope. Change a query or a rule once and every consumer gets the same governed answer — and Snowflake sees far fewer queries.

Repo layout

backend/
  api/
    snowflake_orchestration/
      api_group.xs
      customers_profile_GET.xs
      customers_search_GET.xs
      metrics_revenue_summary_GET.xs
  function/
    snowflake_orchestration_cache_get.xs
    snowflake_orchestration_cache_put.xs
    snowflake_orchestration_check_auth.xs
    snowflake_orchestration_envelope.xs
    snowflake_orchestration_log_request.xs
    snowflake_orchestration_query_customer_profile.xs
    snowflake_orchestration_query_customer_search.xs
    snowflake_orchestration_query_revenue_summary.xs
    snowflake_orchestration_validate_customer_profile.xs
    snowflake_orchestration_validate_customer_search.xs
    snowflake_orchestration_validate_revenue_summary.xs
  table/
    api_request_logs.xs
    cached_query_results.xs
    query_audit_logs.xs
  workflow_test/
    snowflake_orchestration_cache_hit.xs
    snowflake_orchestration_validation_failure.xs
  workspace/
    snowflake_orchestration.xs

How it works

  • Auth to Snowflake — the endpoints call Snowflake's SQL API v2 with a Programmatic Access Token (the SNOWFLAKE_PASSWORD value) plus the PROGRAMMATIC_ACCESS_TOKEN token-type header; SNOWFLAKE_ACCOUNT builds the host and DATABASE/SCHEMA/WAREHOUSE/ROLE set the session context. Queries are parameterized with bind variables (no string interpolation).
  • Governance per request — every endpoint runs a shared gate: validate the input, check the API secret, serve from the read-through cache if a fresh result exists (else query Snowflake and cache it for 15 minutes), and wrap the result in the normalized envelope. Every call writes an api_request_logs row and a query_audit_logs row.
  • Three endpoints — customer search, a single customer profile, and a monthly revenue summary (grouped by DATE_TRUNC('MONTH', ORDER_DATE)), each backed by a pure validation function and a query function you can point at your own columns.

Quick start

Start with your coding agent. Paste the prompt below into a local MCP-capable coding agent — Claude Code, Cursor, Windsurf, and others. It installs the Xano CLI, connects Xano, and imports this template.

Start building in Xano: Access the prompt at https://go.xano.co/start-xano-with-template-skill and run it here with orchestration-layer-snowflake as your template.

The agent will walk you through the setup below.

  1. Push the backend to a Xano workspace (the CLI/agent flow below does this).
  2. Call the endpointsGET /customers/search, GET /customers/{customer_id}/profile, GET /metrics/revenue-summary.
  3. What runs without Snowflake. Input validation, the shared-secret auth (a no-op when API_AUTH_SECRET is unset), the read-through cache on a hit, and the response envelope all run out of the box; the live queries need your Snowflake account + PAT and the CUSTOMERS / ORDERS objects below. Set the environment variables to connect.

API surface

All endpoints live in the SnowflakeOrchestration API group (canonical snowflake-orchestration), require the api_secret field when API_AUTH_SECRET is set, and return one normalized envelope. Every call is audited.

Method Path Purpose
GET /customers/search Search CUSTOMERS (by name/email/status), validated + cached.
GET /customers/{customer_id}/profile A single customer's profile from CUSTOMERS.
GET /metrics/revenue-summary Monthly revenue from ORDERS, grouped by month (cached 15 min).

Database Tables

  • cached_query_results — the read-through cache: one row per query key with the stored result and its 15-minute expiry.
  • query_audit_logs — one row per Snowflake query issued (which query, params, timing).
  • api_request_logs — one row per API call (endpoint, requester, status), for access auditing.

Testing

Run from a deployed workspace with xano workflow_test run_all / xano unit_test run_all:

  • snowflake_orchestration_cache_hit — a repeated query serves from cached_query_results without touching Snowflake.
  • snowflake_orchestration_validation_failure — an invalid request is rejected by the validation gate before any query runs.
  • Unit tests on the pure validation functions (snowflake_orchestration_validate_*).

These exercise the validation, cache, and envelope logic without a Snowflake account; the live query path requires your credentials.

Environment variables

Set these to connect your Snowflake account. The validation/cache/auth/envelope logic runs without them.

  • SNOWFLAKE_ACCOUNT — your account identifier; builds the https://<account>.snowflakecomputing.com host.
  • SNOWFLAKE_PASSWORD — the Programmatic Access Token value, sent as the Bearer token (mint via ALTER USER <user> ADD PROGRAMMATIC ACCESS TOKEN <name>; PATs require a network policy on the user/account).
  • SNOWFLAKE_USERNAME — the user the token belongs to; sent in the User-Agent so calls are attributable.
  • SNOWFLAKE_DATABASE, SNOWFLAKE_SCHEMA, SNOWFLAKE_WAREHOUSE, SNOWFLAKE_ROLE — the statement session context.
  • API_AUTH_SECRET — shared secret every endpoint checks (api_secret field). When unset the check is a no-op so it runs out of the box; set it in production.

Required Snowflake objects. The query functions read two objects in your configured database/schema — provide them as tables or views:

  • CUSTOMERS (/customers/search, /customers/{id}/profile): CUSTOMER_ID, NAME, EMAIL, STATUS (ACTIVE/INACTIVE/PROSPECT), PHONE, CREATED_AT.
  • ORDERS (/metrics/revenue-summary): ORDER_DATE (grouped by month), AMOUNT (summed).

Adjust the column names in the three snowflake_orchestration_query_* functions if your schema differs.

Frequently asked questions

What's the difference between this and the Operational Data Hub template?
They share the same governance pattern in front of Snowflake — access control, input validation, a 15-minute read-through cache, and a normalized response envelope. The difference is packaging: Operational Data Hub is a full app with a frontend dashboard and seed flow, while this is the backend-only version — the reusable API and governance layer without a frontend.
No. It calls Snowflake's SQL API, which is available on trial accounts. You provision a Programmatic Access Token and point the template's connection variables at your account.
Generate a Programmatic Access Token (PAT) for the user and role the layer should use — `ALTER USER ADD PROGRAMMATIC ACCESS TOKEN ` — then set it as SNOWFLAKE_PASSWORD. Note that PAT auth requires a network policy on the user or account first; without one, Snowflake rejects the token.
Every template runs on any Xano plan, including the free tier. All you need is a Xano account and a coding agent connected to the CLI and Developer MCP.
You can import and run it with your local coding agent — it works against the seed data it ships with. Paste this prompt into your agent: Start building in Xano: Access the prompt at https://go.xano.co/start-xano-with-template-skill and run it here with orchestration-layer-snowflake as your template. You can also do a manual clone from Github, still using the Xano CLI and Developer MCP to connect to Xano to build and deploy.
Yes — that's the intent. The backend is plain XanoScript that you can read and AI can build on: add or edit tables, endpoints, and logic, or swap integrations. It ships with tests you can extend as you go.
Xano gives you an enterprise-grade backend — database, APIs, and logic — that AI can build and you can visually inspect, edit, and trust. Hosted, scalable, and production-ready from day one. Speed of generation, without the black box.

Get started for free today

Xano gives you everything you need to ship modern applications—fast, securely, and at scale.

Get started