Request a demo
Use case

Use case: a finance team's daily pull from a provider API

A worked example: a made-up logistics company's finance data team pulls yesterday's fuel-card transactions from a provider's REST API and loads them without a hand-written DAG, with an anomaly rule written as one readable query.

November 4, 2026 · 6 min read · All articles

Not every pipeline is a big file drop. A lot of finance and operations data arrives through a provider's API: card transactions, tolls, telematics, payroll exports. The pipeline is short (call the API, land the data, apply a rule or two) and it is exactly the kind of job that ends up as a script on someone's laptop. Drawing it in InsightDataFlow puts it on the same scheduler, with the same review, as every other pipeline.

Example · a made-up logistics company

Northbeam's fuel cards

Northbeam Logistics (a fictional company) pays for diesel with fuel cards from a provider whose API returns the previous day's transactions. Omar, in the finance data team, needs them in finance.fuel_tx by mid-morning, with any transaction for more litres than the vehicle's tank holds flagged for review. Until now a script did it when Omar remembered.

Four nodes

The fuel_card_transactions workflow on the designer canvas: Start, Fetch transactions, Load finance.fuel_tx, Flag anomalies and End, five nodes and four links, saved.
Omar's pipeline in the designer: five nodes, four links. The provider and its API are made up.
  1. Fetch transactions (API): a flexible REST caller with a base URL, an endpoint, a method, headers, query parameters and a body. Omar sets the base URL and /v1/transactions, and sets the method to GET (the node defaults to POST).
  2. Load finance.fuel_tx (LOAD_DATABASE): load the day's transactions into the finance schema through the warehouse data location.
  3. Flag anomalies: one query that selects the transactions where the litres exceed the tank size, run as a LOAD_DATABASE step whose input source is that query, writing to finance.fuel_tx_flags through the same warehouse data location. Finance can read the rule, and change it, without touching Python.

In the workflow list the pipeline is source API, category finance, priority P2, schedule 30 6 * * *.

Decide where the key lives before you build. The API node takes its headers as plain parameters and has no data-location field, so an API key typed into a header is an API key in properties.yaml and in every deployed copy of it. Agree with your platform team how the provider's key is supplied at run time, and treat the deployed folder as sensitive either way.

The hand-off between the call and the load

One detail is easy to miss on a canvas. An edge says "run the load after the call"; it does not pipe the API's response into the load. LOAD_DATABASE reads a CSV file, a Parquet file or a table, and the API node returns the response as its result. So the pipeline needs an agreed place in between: the provider's export written to a file in the landing bucket, or a staging table, which the load then reads. Design and test that hand-off first. It is the step most likely to work in a test and fail on the first real night.

The API node, filled in

ParameterOmar's value (made up)Why
Base URL + endpointhttps://api.fuelcards.example.test + /v1/transactionsOr one complete URL in the URL field instead.
MethodGETThe default is POST; a read-only pull should say GET.
QueryA JSON object with the day to fetchKept apart from the endpoint so a reviewer sees what changes per run.
TimeoutRaised from the default 30 secondsProvider APIs can be slow early in the morning; a timeout is a failed task.

Reruns and duplicates

A finance table must not double-count. LOAD_DATABASE appends by default, so a rerun after a partial failure appends the same transactions twice. The load node also offers overwrite, replace and truncate modes. Two workable patterns:

  • Truncate a staging table, then insert. Load the day into a staging table in truncate mode, and delete that day from finance.fuel_tx and insert it again (a SHELL step that runs both statements with your database client). Reruns are safe; the rule stays readable.
  • Append with a guard. Keep append, and add a check after the load that fails when a transaction id appears twice. Simpler, but a rerun then needs a manual clean-up.

Whichever you pick, remember the generated DAG retries a failed task once, five minutes later, and that retry is itself a rerun.

Why not keep the script?

  • It runs when nobody remembers. The schedule is Airflow's, not Omar's calendar.
  • It fails visibly. A failed API call or load is a failed task in Airflow with a name ("Fetch transactions"), not a missing email.
  • It is reviewable. The anomaly rule is a line in properties.yaml; a change to it is a diff someone approves.
  • It is like everything else. The DAG has the same shape as the logistics team's nightly load, so the platform team operates both the same way.
Example · a month later

The rule changes; the pipeline does not

Finance decides that a transaction outside the driver's planned route is also worth flagging. Omar adds a second rule step after the first, regenerates, and the reviewer sees one new task and one new query. Nothing else in the pipeline moves. An illustration on made-up data.

Questions the finance team asks

Can we change the anomaly rule ourselves?

The rule is a query in a node's parameters, editable in the designer by anyone with the role to save and deploy workflows (admin, in the API). Finance can hold that role, or send the change to the data team for review: your governance decides.

What happens when the provider's API is down?

The call fails, Airflow retries it once, and then the task fails under its own name. Nothing downstream runs, so the table keeps yesterday's data rather than a half-loaded day.

Does the provider page its results?

Ask before you build. The API node makes one request per run; a paged API needs the pages handled somewhere, ideally by an export endpoint that returns the whole day.

Can it run more than once a day?

Yes: the schedule is a cron expression, so an intraday pull is a schedule change. Generated DAGs allow one active run at a time, so a slow run delays the next one instead of overlapping it, which for a finance table is the behaviour you want.

Checklist for API pipelines

  1. Find out how the provider pages results and what "yesterday" means in its time zone.
  2. Decide what a rerun does: append duplicates, or replace the day. Make the load match.
  3. Add a check after the load (a RECORD_COUNT_VALIDATION node) so an empty response is a failure, not a quiet zero.
  4. Keep credentials in the data location, not in parameters; review properties.yaml before every deploy, and restrict who can read the deployed config.yaml, which carries the location's credentials.

Next: use case: dbt models and a dashboard refresh.

Draw one of your pipelines with us

Bring a pipeline you run today, hand-written or scheduled somewhere else. We will draw it in the designer, generate the DAG and walk through deploying it to your Airflow.

Request a demo