Query GTM API prices with DuckDB, jq and Python
Every query below runs on datacircle.json as you download it. The DuckDB queries also run on datacircle.csv. jq and Python read the JSON only.
DuckDB
Section titled “DuckDB”An API’s paid plans under $50, cheapest per 1,000 first:
SELECT provider, plan, billing, pay, currency, perThousand, score, page, docsFROM 'datacircle.json'WHERE api = 'Employee email' AND billing != 'free' AND pay * exchangeRate <= 50 AND perThousand IS NOT NULLORDER BY perThousand LIMIT 10;An API’s best scored plans, with each part of the score:
SELECT provider, plan, call, score, priceScore, dataScore, costToGetStartedScore, bundleScore, performanceScore, page, docsFROM 'datacircle.json'WHERE api = 'Employee profile' AND score IS NOT NULLORDER BY score DESC LIMIT 10;One provider’s plans:
SELECT api, plan, billing, pay, perThousand, page, docsFROM 'datacircle.json'WHERE provider ILIKE '%fetchin%'ORDER BY api, perThousand;The cheapest paid plan per 1,000 of each API:
SELECT api, arg_min(provider || ', ' || plan, perThousand) AS plan, min(perThousand) AS perThousandFROM 'datacircle.json'WHERE billing != 'free' AND perThousand IS NOT NULLGROUP BY api ORDER BY api;The APIs under one category:
SELECT subcategory, sheet, api, count(*) AS plansFROM 'datacircle.json'WHERE category = 'Email and phone'GROUP BY ALL ORDER BY subcategory, sheet;jq '[.[] | select(.api == "Employee email" and .billing != "free" and .pay != null and .pay * .exchangeRate <= 50 and .perThousand != null)] | sort_by(.perThousand) | .[:10] | map({provider, plan, pay, currency, perThousand, score, page, docs})' datacircle.jsonPython
Section titled “Python”import json
rows = json.load(open("datacircle.json"))found = sorted( (r for r in rows if r["api"] == "Employee email" and r["billing"] != "free" and r["pay"] is not None and r["pay"] * r["exchangeRate"] <= 50 and r["perThousand"] is not None), key=lambda r: r["perThousand"],)[:10]for r in found: print(r["provider"], r["plan"], r["perThousand"], r["page"], r["docs"])