Skip to content

Every minute to daily

Save API snapshots to a BigQuery table

Data from an API is appended to your table with a timestamp on each run, building a history you can query.

Runs
Every minute to daily
Apps
BigQuery
AI
Not needed
Access
write (Data Editor)

Send this to your assistant

Create a ClickRuntime automation: every hour, fetch account balances from https://api.example.com/v1/balances and insert them as rows into analytics.balance_history in BigQuery with a fetched_at timestamp.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Finance and operations teams often need history that the source system does not keep. A broker API returns today's positions, a payment provider returns current balances, an ad platform returns account status, but each call shows only the present moment. When an auditor asks what the balance was on the 3rd, or a trader wants to chart exposure over a month, the answer is gone because nobody saved yesterday's response.

On a schedule you set, from every minute to once a day, ClickRuntime calls the source API, maps the fields in the response to the columns of your BigQuery table and inserts the rows. Each run appends rather than overwrites, so the table grows into a time series you can query, chart or join with other data.

It is useful whenever a number lives behind an API that only tells you the current value.

What you get out of it

  • History that the source never kept

    Appending a row on every run creates a record of how positions or balances moved over time. Questions about last Tuesday can be answered with a query instead of a shrug.

  • Audit trails for balances and accounts

    A dated snapshot of account state is evidence when reconciling statements or explaining a discrepancy. Reviewers can point at a row with a timestamp instead of relying on someone's memory.

  • Charts and trend analysis become possible

    Once snapshots sit in BigQuery, any BI tool can plot them. You can see drift, seasonality and sudden changes that a single current-value call would never reveal. Trends often matter more than any single reading.

  • No fragile cron scripts to maintain

    A schedule, a field mapping and an insert step replace a script on someone's laptop or a forgotten server. If the API response changes shape, the run history shows where it failed.

  • Frequency matched to the data

    Fast-moving values can be captured every minute and slow ones once a day. You pay for rows you need instead of over-collecting or missing movement. A slow-moving account balance gains nothing from a minute-by-minute capture, and a fast price feed suffers from a daily one.

How it works

What happens, step by step

  1. On the schedule you set, from every minute to once a day, ClickRuntime fetches the latest figures from the data source, such as a price feed.

  2. It shapes them into a row with the time they were fetched.

  3. It adds the row to your BigQuery table. Each run adds one row and never duplicates it, so you build up a history you can query.

Before it runs live

  • Connect BigQuery

What you get

RunsEvery minute to daily
Save API snapshots to a BigQuery tabletoday, 9:00Succeeded
BigQuery · snapshots.btc_pricefetched_at 2026-10-19T09:00:00Z · pair BTC-USD · price 68412.55

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other BigQuery steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
log_api_snapshots_into_a_table_on_a_schedule.pyexample
from datetime import datetime, timezone
from clickruntime import on_trigger, credentials, http

TABLE = "https://bigquery.googleapis.com/bigquery/v2/projects/my-project/datasets/snapshots/tables/btc_price"

@on_trigger
def run(event):
    data = http.get("https://api.coinbase.com/v2/prices/BTC-USD/spot").json()["data"]
    row = {"fetched_at": datetime.now(timezone.utc).isoformat(), "pair": f"{data['base']}-{data['currency']}", "price": float(data["amount"])}
    res = http.post(f"{TABLE}/insertAll", headers={"Authorization": f"Bearer {credentials.connection('google', 'work')}"},
                    json={"rows": [{"insertId": event.get("scheduled_time") or row["fetched_at"], "json": row}]}).json()
    if res.get("insertErrors"):
        raise RuntimeError(f"insert failed: {res['insertErrors']}")
    return row

FAQ

Common questions

Does each run replace the table or add to it?
It inserts new rows, so earlier snapshots stay in place. Add a snapshot timestamp column to the mapping so every row records when it was taken, which makes later queries by date straightforward. Nothing is deleted by later runs.
What happens if the source API is down during a run?
The fetch step fails for that run and nothing is inserted, so you will have a gap in the series for that interval. The failure appears in the run log, and the next scheduled run goes ahead normally.
How do I decide which fields go into the table?
You list the fields from the API response that matter and match them to BigQuery columns, including types such as numeric or timestamp. Fields you leave out are simply not stored. Create the table with matching columns first.
What permissions does it need?
write (Data Editor). Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (every minute to daily). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Save API snapshots to a BigQuery table” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.