{"id":6883,"date":"2026-09-27T10:49:19","date_gmt":"2026-09-27T15:49:19","guid":{"rendered":"https:\/\/querystreams.com\/docs\/google-analytics-4-data-rest-api\/"},"modified":"2026-11-10T12:55:13","modified_gmt":"2026-11-10T18:55:13","password":"","slug":"google-analytics-4-data-rest-api","status":"publish","type":"docs","link":"https:\/\/querystreams.com\/fr\/docs\/google-analytics-4-data-rest-api\/","title":{"rendered":"API REST de donn\u00e9es Google Analytics 4\u00a0: Transformer une requ\u00eate SQL en point de terminaison"},"content":{"rendered":"\n<article class=\"qs-d qs-d--api\" data-src=\"google_analytics_4\" data-dest=\"api\" style=\"--qs-src:227 116 0;--qs-src-deep:71 36 0;--qs-src-ink:184 94 0;--qs-src-tint:#E87700;--qs-dst:59 130 246;--qs-dst-tint:#93C5FD\">\n<header class=\"qs-d-hero\"><div class=\"qs-d-hero__pair\"><a class=\"lnk\" href=\"https:\/\/querystreams.com\/database-integrations\/google-analytics-4\/\" aria-label=\"GA4: all integrations\" data-qs-cta=\"hub_page\"><img decoding=\"async\" class=\"src\" src=\"https:\/\/querystreams.com\/wp-content\/uploads\/2025\/12\/icon-google-analytics.png\" alt=\"\" width=\"44\" height=\"44\" loading=\"eager\"><\/a><i class=\"fa-solid fa-arrow-right\" aria-hidden=\"true\"><\/i><a class=\"lnk\" href=\"https:\/\/querystreams.com\/features\/database-rest-api\/\" aria-label=\"Database REST API feature\" data-qs-cta=\"feature\"><img decoding=\"async\" class=\"dst\" src=\"https:\/\/querystreams.com\/wp-content\/uploads\/2026\/08\/database-rest-api.128.png\" alt=\"\" width=\"44\" height=\"44\" loading=\"eager\"><\/a><\/div><span class=\"qs-d-eyebrow\">REST API &middot; GA4 to an endpoint<\/span><p class=\"qs-d-hero__title\">Turn a <em class=\"src\">GA4<\/em> SQL query into a <em class=\"dst\">REST API<\/em> endpoint<\/p><p class=\"qs-d-hero__sub\">Save a query in Query Builder, click <strong>New endpoint<\/strong>, and you have a URL at api.querystreams.com with its own key. The SQL runs read-only on the Agent that already sits with your GA4 account; the caller gets JSON or CSV and never sees the SQL, the schema or a password. Nothing to host, no port to open. About 90 seconds from a saved query, and the Free plan covers your first endpoint.<\/p><div class=\"qs-d-hero__meta\"><span class=\"qs-d-pill\"><i class=\"fa-solid fa-clock\"><\/i> About 90 seconds from a saved query<\/span><span class=\"qs-d-pill\"><i class=\"fa-solid fa-server\"><\/i> No server to host<\/span><span class=\"qs-d-pill src\"><i class=\"fa-solid fa-shield-halved\"><\/i> Credentials stay with you<\/span><span class=\"qs-d-pill\"><i class=\"fa-solid fa-key\"><\/i> One key per caller, revoke anytime<\/span><\/div><\/header>\n<div class=\"qs-d-support\" data-zone=\"mint\" data-qs-seen=\"support\"><span class=\"qs-d-chip\"><i class=\"fa-solid fa-life-ring\"><\/i><\/span><div class=\"qs-d-support__body\"><strong>Stuck at any point? Just ask us.<\/strong> Open <a href=\"https:\/\/my.querystreams.com\/support\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"support\">Support<\/a> in Query Streams (top-right menu &rarr; Support) and send us a message. Real people read it, and &ldquo;I don&rsquo;t know what this screen is asking for&rdquo; is a perfectly good question.<\/div><\/div>\n\n<h2 id=\"result\">What you&rsquo;ll end up with<\/h2>\n<p class=\"qs-d-lead\"><img decoding=\"async\" class=\"qs-d-lead__icon\" src=\"https:\/\/querystreams.com\/wp-content\/uploads\/2025\/12\/icon-google-analytics.png\" alt=\"Google Analytics 4 logo\" width=\"28\" height=\"28\">A URL at <code>api.querystreams.com<\/code> that returns the rows of your saved GA4 query as JSON or CSV to anyone holding a key, tested from the console in the portal before you share it. Like this:<\/p>\n<div class=\"qs-d-console\" data-qs-seen=\"console\" aria-label=\"The Query Streams API console: a POST request to an endpoint URL, one parameter, and a 200 OK JSON response with columns, rows and meta from your GA4 account\"><div class=\"qs-d-console__bar\"><span class=\"qs-d-console__method\">POST<\/span><span class=\"qs-d-console__url\">api.querystreams.com\/v1\/endpoints\/8f2c4d1e-6b3a-4f7e-9c21-5d0a7b3e2f19<\/span><button type=\"button\" class=\"qs-d-console__btn ghost\" data-copy=\"https:\/\/api.querystreams.com\/v1\/endpoints\/8f2c4d1e-6b3a-4f7e-9c21-5d0a7b3e2f19\"><i class=\"fa-regular fa-copy\" aria-hidden=\"true\"><\/i> <span>Copy URL<\/span><\/button><button type=\"button\" class=\"qs-d-console__btn send\" data-send><i class=\"fa-solid fa-paper-plane\" aria-hidden=\"true\"><\/i> Send<\/button><\/div><div class=\"qs-d-console__tabs\" role=\"tablist\"><button type=\"button\" role=\"tab\" class=\"is-on\" aria-selected=\"true\" data-tab=\"params\">Params<\/button><button type=\"button\" role=\"tab\" aria-selected=\"false\" data-tab=\"body\">Body<\/button><button type=\"button\" role=\"tab\" aria-selected=\"false\" data-tab=\"headers\">Headers<\/button><button type=\"button\" role=\"tab\" aria-selected=\"false\" data-tab=\"code\">Code<\/button><\/div><div class=\"qs-d-console__pane is-on\" data-pane=\"params\"><table class=\"qs-d-console__params\"><thead><tr><th>Key<\/th><th>Value<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>total_users<\/code> <em>string<\/em> <i>Optional<\/i><\/td><td>Seattle<\/td><td>Callable filter from the saved query<\/td><\/tr><tr class=\"hdr\"><td><code>X-API-Key<\/code><\/td><td>qsapi_AB&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;<\/td><td>Your secret token<\/td><\/tr><\/tbody><\/table><\/div><div class=\"qs-d-console__pane\" data-pane=\"body\"><pre class=\"qs-d-code__body qs-d-console__body\">{\n  <span class=\"k\">&quot;total_users&quot;<\/span>: <span class=\"s\">&quot;Seattle&quot;<\/span>\n}<\/pre><\/div><div class=\"qs-d-console__pane\" data-pane=\"headers\"><table class=\"qs-d-console__params\"><thead><tr><th>Header<\/th><th>Value<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>X-API-Key<\/code><\/td><td>qsapi_AB&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;<\/td><td>Your secret token. One per caller, revoke anytime.<\/td><\/tr><tr><td><code>Content-Type<\/code><\/td><td>application\/json<\/td><td>The parameters travel as a JSON body<\/td><\/tr><tr><td><code>Accept<\/code><\/td><td>application\/json<\/td><td>JSON back; ask for text\/csv and you get CSV<\/td><\/tr><\/tbody><\/table><\/div><div class=\"qs-d-console__pane\" data-pane=\"code\"><pre class=\"qs-d-code__body qs-d-console__body\">curl -X POST &quot;https:\/\/api.querystreams.com\/v1\/endpoints\/8f2c4d1e-6b3a-4f7e-9c21-5d0a7b3e2f19&quot; \\\n  -H &quot;X-API-Key: qsapi_YOUR_KEY&quot; \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -d &#039;{&quot;total_users&quot;: &quot;Seattle&quot;}&#039;<\/pre><\/div><div class=\"qs-d-console__resp\"><div class=\"qs-d-console__badges\"><span class=\"ok\">Status <b>200 OK<\/b><\/span><span>Time <b data-time>84 ms<\/b><\/span><span>Size <b>412 B<\/b><\/span><span>Truncated <b>no<\/b><\/span><\/div><div class=\"qs-d-console__rtabs\" role=\"tablist\"><button type=\"button\" role=\"tab\" class=\"is-on\" aria-selected=\"true\" data-tab=\"rbody\">Body<\/button><button type=\"button\" role=\"tab\" aria-selected=\"false\" data-tab=\"rheaders\">Headers<\/button><\/div><div class=\"qs-d-console__pane is-on\" data-pane=\"rbody\"><pre class=\"qs-d-code__body qs-d-console__body\">{\n  <span class=\"k\">&quot;columns&quot;<\/span>: [ { <span class=\"k\">&quot;name&quot;<\/span>: <span class=\"s\">&quot;date&quot;<\/span>, <span class=\"k\">&quot;type&quot;<\/span>: <span class=\"s\">&quot;integer&quot;<\/span> }, { <span class=\"k\">&quot;name&quot;<\/span>: <span class=\"s\">&quot;sessions&quot;<\/span>, <span class=\"k\">&quot;type&quot;<\/span>: <span class=\"s\">&quot;string&quot;<\/span> }, { <span class=\"k\">&quot;name&quot;<\/span>: <span class=\"s\">&quot;total_users&quot;<\/span>, <span class=\"k\">&quot;type&quot;<\/span>: <span class=\"s\">&quot;string&quot;<\/span> } ],\n  <span class=\"k\">&quot;rows&quot;<\/span>: [\n    { <span class=\"k\">&quot;date&quot;<\/span>: <span class=\"n\">1042<\/span>, <span class=\"k\">&quot;sessions&quot;<\/span>: <span class=\"s\">&quot;Northwind Traders&quot;<\/span>, <span class=\"k\">&quot;total_users&quot;<\/span>: <span class=\"s\">&quot;Seattle&quot;<\/span> },\n    { <span class=\"k\">&quot;date&quot;<\/span>: <span class=\"n\">1057<\/span>, <span class=\"k\">&quot;sessions&quot;<\/span>: <span class=\"s\">&quot;Alpine Outfitters&quot;<\/span>, <span class=\"k\">&quot;total_users&quot;<\/span>: <span class=\"s\">&quot;Denver&quot;<\/span> },\n    { <span class=\"k\">&quot;date&quot;<\/span>: <span class=\"n\">1063<\/span>, <span class=\"k\">&quot;sessions&quot;<\/span>: <span class=\"s\">&quot;Harbour Foods&quot;<\/span>, <span class=\"k\">&quot;total_users&quot;<\/span>: <span class=\"s\">&quot;Halifax&quot;<\/span> }\n  ],\n  <span class=\"k\">&quot;meta&quot;<\/span>: { <span class=\"k\">&quot;row_count&quot;<\/span>: <span class=\"n\">3<\/span>, <span class=\"k\">&quot;agent_duration_ms&quot;<\/span>: <span class=\"n\">41<\/span>, <span class=\"k\">&quot;request_id&quot;<\/span>: <span class=\"s\">&quot;req_7Hq2mKd9&quot;<\/span> }\n}<\/pre><\/div><div class=\"qs-d-console__pane\" data-pane=\"rheaders\"><table class=\"qs-d-console__params\"><thead><tr><th>Header<\/th><th>Value<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>content-type<\/code><\/td><td>application\/json; charset=utf-8<\/td><td>The envelope on the Body tab<\/td><\/tr><tr><td><code>content-length<\/code><\/td><td>412<\/td><td>Bytes returned; the Size badge above<\/td><\/tr><\/tbody><\/table><\/div><\/div><div class=\"qs-d-console__foot\"><span><i class=\"fa-solid fa-lock\"><\/i> Read-only: one saved query, nothing else<\/span><span><i class=\"fa-solid fa-eye-slash\"><\/i> SQL never leaves your account<\/span><span><i class=\"fa-solid fa-list-check\"><\/i> Every call on the Activity tab<\/span><\/div><\/div><script>(function(){document.addEventListener(\"click\",function(ev){var t=ev.target.closest(\".qs-d-console [data-tab],.qs-d-console [data-copy],.qs-d-console [data-send]\");if(!t)return;var con=t.closest(\".qs-d-console\");if(t.hasAttribute(\"data-tab\")){var list=t.parentNode,id=t.getAttribute(\"data-tab\");list.querySelectorAll(\"[data-tab]\").forEach(function(b){var on=b===t;b.classList.toggle(\"is-on\",on);b.setAttribute(\"aria-selected\",on?\"true\":\"false\");});var scope=list.classList.contains(\"qs-d-console__rtabs\")?list.parentNode:con;scope.querySelectorAll(\":scope > .qs-d-console__pane\").forEach(function(p){p.classList.toggle(\"is-on\",p.getAttribute(\"data-pane\")===id);});return;}if(t.hasAttribute(\"data-copy\")){var lab=t.querySelector(\"span\"),done=function(){lab.textContent=\"Copied\";t.classList.add(\"is-done\");setTimeout(function(){lab.textContent=\"Copy URL\";t.classList.remove(\"is-done\");},1600);};if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(t.getAttribute(\"data-copy\")).then(done,done);}else{done();}return;}if(t.hasAttribute(\"data-send\")){var r=con.querySelector(\".qs-d-console__resp\"),tm=con.querySelector(\"[data-time]\");r.classList.remove(\"is-sent\");void r.offsetWidth;r.classList.add(\"is-sent\");if(tm)tm.textContent=(60+Math.floor(Math.random()*50))+\" ms\";setTimeout(function(){r.classList.remove(\"is-sent\");},700);}},false);})();<\/script>\n<p>Google Analytics 4 holds your data behind its own API. Someone else wants a slice of it in their app, their dashboard or their script, and the usual answers all hand over too much: a database login that outlives the project, a nightly export that is stale by breakfast, or a small API server that somebody now has to run and patch. Query Streams makes the endpoint a saved query plus a key. The Agent that already sits with your GA4 account runs the query, api.querystreams.com checks the key and the rate limit, and the caller gets rows. The SQL, the schema and the credentials never leave your account.<\/p>\n<figure class=\"qs-d-figure\" data-qs-seen=\"flow\"><svg viewBox=\"0 0 900 210\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" role=\"img\" aria-label=\"WHERE THE AGENT RUNS, holds your GA4 account and the Query Streams Agent. The Agent runs the saved query and streams the rows to api.querystreams.com, which checks the key and answers your app or partner over HTTPS.\"><defs><marker id=\"qsArrowA\" viewBox=\"0 0 10 10\" refX=\"9\" refY=\"5\" markerWidth=\"8\" markerHeight=\"8\" orient=\"auto-start-reverse\"><path d=\"M0,0 L10,5 L0,10 z\" fill=\"#6589A6\"\/><\/marker><\/defs><rect x=\"14\" y=\"14\" width=\"380\" height=\"166\" rx=\"16\" fill=\"#ffffff\" stroke=\"#E37400\" stroke-width=\"2\" stroke-dasharray=\"6 5\"\/><text x=\"32\" y=\"38\" font-family=\"Poppins, sans-serif\" font-size=\"11\" font-weight=\"600\" fill=\"#13323b\" letter-spacing=\"1.5\">WHERE THE AGENT RUNS<\/text><text x=\"32\" y=\"54\" font-family=\"system-ui, sans-serif\" font-size=\"11\" fill=\"#7D8688\">any always-on computer or server with internet<\/text><rect x=\"36\" y=\"72\" width=\"160\" height=\"78\" rx=\"12\" fill=\"#E37400\" fill-opacity=\".12\" stroke=\"#E37400\" stroke-width=\"1.5\"\/><text x=\"116\" y=\"104\" text-anchor=\"middle\" font-family=\"Poppins, sans-serif\" font-size=\"14\" font-weight=\"600\" fill=\"#13323b\">Your GA4 account<\/text><text x=\"116\" y=\"126\" text-anchor=\"middle\" font-family=\"system-ui, sans-serif\" font-size=\"12\" fill=\"#E37400\">keys stay here<\/text><rect x=\"212\" y=\"72\" width=\"160\" height=\"78\" rx=\"12\" fill=\"#13323B\"\/><text x=\"292\" y=\"104\" text-anchor=\"middle\" font-family=\"Poppins, sans-serif\" font-size=\"14\" font-weight=\"600\" fill=\"#ffffff\">Query Streams Agent<\/text><text x=\"292\" y=\"126\" text-anchor=\"middle\" font-family=\"system-ui, sans-serif\" font-size=\"12\" fill=\"#a9dfcb\">runs the saved query<\/text><line x1=\"198\" y1=\"111\" x2=\"208\" y2=\"111\" stroke=\"#6589A6\" stroke-width=\"2.5\" marker-end=\"url(#qsArrowA)\"\/><line x1=\"394\" y1=\"111\" x2=\"428\" y2=\"111\" stroke=\"#6589A6\" stroke-width=\"2.5\" stroke-dasharray=\"4 4\" marker-end=\"url(#qsArrowA)\"\/><rect x=\"432\" y=\"80\" width=\"110\" height=\"62\" rx=\"31\" fill=\"#3B82F6\"\/><text x=\"487\" y=\"106\" text-anchor=\"middle\" font-family=\"Poppins, sans-serif\" font-size=\"12\" font-weight=\"700\" fill=\"#ffffff\">api.querystreams<\/text><text x=\"487\" y=\"124\" text-anchor=\"middle\" font-family=\"system-ui, sans-serif\" font-size=\"10.5\" fill=\"#dbeafe\">checks the key<\/text><line x1=\"544\" y1=\"111\" x2=\"578\" y2=\"111\" stroke=\"#6589A6\" stroke-width=\"2.5\" stroke-dasharray=\"4 4\" marker-end=\"url(#qsArrowA)\"\/><text x=\"487\" y=\"166\" text-anchor=\"middle\" font-family=\"system-ui, sans-serif\" font-size=\"11\" fill=\"#6589A6\">HTTPS &middot; rows only, never the SQL<\/text><rect x=\"582\" y=\"14\" width=\"304\" height=\"166\" rx=\"16\" fill=\"#ffffff\" stroke=\"#3B82F6\" stroke-width=\"2\" stroke-dasharray=\"6 5\"\/><text x=\"600\" y=\"38\" font-family=\"Poppins, sans-serif\" font-size=\"11\" font-weight=\"600\" fill=\"#1E3A8A\" letter-spacing=\"1.5\">WHOEVER HOLDS A KEY<\/text><text x=\"600\" y=\"54\" font-family=\"system-ui, sans-serif\" font-size=\"11\" fill=\"#7D8688\">your app, a dashboard, a partner, a script<\/text><rect x=\"604\" y=\"72\" width=\"260\" height=\"78\" rx=\"12\" fill=\"#eff6ff\" stroke=\"#bfdbfe\"\/><text x=\"734\" y=\"104\" text-anchor=\"middle\" font-family=\"Poppins, sans-serif\" font-size=\"14\" font-weight=\"600\" fill=\"#1E3A8A\">GET or POST with X-API-Key<\/text><text x=\"734\" y=\"126\" text-anchor=\"middle\" font-family=\"system-ui, sans-serif\" font-size=\"12\" fill=\"#1d4ed8\">JSON, CSV or NDJSON back<\/text><\/svg><figcaption>The Agent lives with your data and runs the query. api.querystreams.com checks the key and rate limit and passes the rows on. The caller never reaches your network.<\/figcaption><\/figure>\n\n<h2 id=\"need\">What you&rsquo;ll need<\/h2>\n<div class=\"qs-d-grid\" data-qs-seen=\"need\"><div class=\"qs-d-card\" data-zone=\"mint\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-card__blob\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-user-plus\"><\/i><\/span><h3>A Query Streams account<\/h3><p>Every plan has the REST API. Free gives you one endpoint, two keys and 250 rows per call, which is enough to build this guide. Sign up at <a href=\"https:\/\/my.querystreams.com\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"signup\">my.querystreams.com<\/a>.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"src\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-card__blob\"><\/span><span class=\"qs-d-chip\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/querystreams.com\/wp-content\/uploads\/2025\/12\/icon-google-analytics.png\" alt=\"\" width=\"22\" height=\"22\" loading=\"lazy\"><\/span><h3>The Agent on any always-on computer, with the GA4 connection added<\/h3><p>It only needs internet access. <a href=\"https:\/\/querystreams.com\/docs\/how-to-connect-google-analytics-to-google-sheets\/\" data-qs-cta=\"connector_guide\">Connect GA4 first<\/a> if you have not.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"dst\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-card__blob\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-floppy-disk\"><\/i><\/span><h3>A saved query in Query Builder<\/h3><p>The endpoint wraps exactly one saved query. Write the SELECT, run it once, save it. Add a Dynamic Filter (a <code>@variable<\/code> in the WHERE clause) if callers should be able to filter.<\/p><\/div><\/div><div class=\"qs-d-note\" data-zone=\"slate\"><i class=\"fa-solid fa-circle-info\"><\/i><p><strong>Who can create endpoints?<\/strong> Owners, Admins and Creators. If the <strong>API<\/strong> item is missing from your top bar, an Admin can switch it on for your user under <strong>Account &rarr; Permissions<\/strong>. Anyone you share an endpoint with only needs a Query Streams account, on any plan.<\/p><\/div>\n\n<h2 id=\"steps\">Set it up in four steps<\/h2>\n<ol class=\"qs-d-steps\" data-qs-seen=\"steps\">\n    <li class=\"qs-d-step\" data-qs-step=\"1\" id=\"step-1\">\n      <h3>Save the query<\/h3>\n      <p>In <a href=\"https:\/\/my.querystreams.com\/query-builder\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"open_query_builder\"><strong>Query Builder<\/strong><\/a> pick your GA4 connection, write the SELECT you want to publish and run it once so you can see the rows. Keep it to the columns the caller needs; the endpoint returns exactly what the query returns.<\/p>\n<div class=\"qs-d-code\" data-qs-hover=\"code\"><div class=\"qs-d-code__hdr\">Saved query &middot; ga4.traffic_overview<\/div>\n<pre class=\"qs-d-code__body\" data-lang=\"sql\"><span class=\"k\">SELECT<\/span> date, sessions, total_users, screen_page_views\n<span class=\"k\">FROM<\/span> ga4.traffic_overview\n<span class=\"k\">ORDER<\/span> <span class=\"k\">BY<\/span> date <span class=\"k\">DESC<\/span>\n<span class=\"k\">LIMIT<\/span> <span class=\"n\">100<\/span>;<\/pre><\/div>\n      <p>If callers should be able to filter, add a Dynamic Filter, for example <code>WHERE total_users = @total_users<\/code>. Each <code>@variable<\/code> becomes an API parameter in step 3. Click <strong>Save<\/strong> and give the query a name; that name becomes the endpoint&rsquo;s display name.<\/p>\n    <\/li>\n    <li class=\"qs-d-step\" data-qs-step=\"2\" id=\"step-2\">\n      <h3>Create the endpoint<\/h3>\n      <p>Open <a href=\"https:\/\/my.querystreams.com\/api\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"open_api\"><strong>API<\/strong><\/a> in the top bar and click <strong>New endpoint<\/strong>. The wizard has four steps, <strong>Pick query<\/strong>, <strong>Configure<\/strong>, <strong>Lock params<\/strong> and <strong>Share<\/strong>. On <strong>Pick query<\/strong>, click the query you just saved; queries whose Agent is offline are greyed out. Click <strong>Next<\/strong>.<\/p>\n      <div class=\"qs-d-cta\"><a class=\"qs-d-btn qs-d-btn--primary\" href=\"https:\/\/my.querystreams.com\/api\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"open_api\"><i class=\"fa-solid fa-plug\"><\/i> Open API<\/a><\/div>\n      <div class=\"qs-d-note\" data-zone=\"slate\"><i class=\"fa-solid fa-circle-info\"><\/i><p><strong>Shortcut.<\/strong> From Query Builder you can expose the open query directly; the wizard then starts at <strong>Configure<\/strong> with the query already chosen.<\/p><\/div>\n    <\/li>\n    <li class=\"qs-d-step\" data-qs-step=\"3\" id=\"step-3\">\n      <h3>Configure and lock parameters<\/h3>\n      <p>On <strong>Configure<\/strong> the defaults are right for a first endpoint: <strong>Display name<\/strong> filled from the query, <strong>Lifespan<\/strong> Permanent (choose <strong>Expiring<\/strong> for a temporary share), <strong>Response mode<\/strong> Static (one JSON response; pick <strong>Streaming<\/strong> for results beyond your plan&rsquo;s static row cap), <strong>Inner format<\/strong> JSON. Response mode and format are fixed once created, so decide them here. Click <strong>Next<\/strong>.<\/p>\n      <p>On <strong>Lock params<\/strong> every Dynamic Filter in the query is listed. Leave the ones callers may set as <strong>Callable<\/strong> and give each a <strong>Query string name<\/strong>; tick <strong>Required<\/strong> if a call without it should fail. Pin a value the caller must not change with <strong>Locked<\/strong>, or a date scenario such as <em>Start of month<\/em>. <strong>Hidden<\/strong> keeps the query&rsquo;s own default and rejects any attempt to set it. Click <strong>Next<\/strong>.<\/p>\n    <\/li>\n    <li class=\"qs-d-step\" data-qs-step=\"4\" id=\"step-4\">\n      <h3>Share and get your key<\/h3>\n      <p>On <strong>Share<\/strong> you can invite <strong>People<\/strong> by email or add a <strong>Service key<\/strong> for a server or an automation tool, or skip both for now. Click <strong>Create &amp; get my key<\/strong>. The success screen shows the endpoint URL and your key: a 49-character string starting <code>qsapi_<\/code>. Copy it. You can reveal it again later from the endpoint&rsquo;s <strong>Sharing<\/strong> tab, so it is not lost if you close the screen.<\/p>\n      <p>Click <strong>Send<\/strong> in the console to make the first call from the portal itself. The response pane shows <strong>Status<\/strong>, <strong>Time<\/strong> and <strong>Size<\/strong>, the <strong>Body<\/strong> tab shows the JSON, and the call appears on the <strong>Activity<\/strong> tab a few seconds later.<\/p>\n    <\/li>\n<\/ol>\n<div class=\"qs-d-note\" data-zone=\"mint\"><i class=\"fa-solid fa-circle-check\"><\/i><p><strong>That&rsquo;s it.<\/strong> Your GA4 account now answers on a URL, read-only, to the keys you hand out. Nothing was installed, no port was opened, and the SQL stayed in your account.<\/p><\/div>\n\n<h2 id=\"call\">Call it from anywhere<\/h2>\n<p>Replace the endpoint id with yours from the console&rsquo;s URL bar and <code>qsapi_YOUR_KEY<\/code> with your key. Callable parameters go in the query string on GET; here the saved query exposes <code>total_users<\/code>:<\/p>\n<div class=\"qs-d-code\" data-qs-hover=\"code\"><div class=\"qs-d-code__hdr\">GET &middot; parameters in the query string<\/div><pre class=\"qs-d-code__body\">curl &quot;https:\/\/api.querystreams.com\/v1\/endpoints\/8f2c4d1e-6b3a-4f7e-9c21-5d0a7b3e2f19?total_users=Seattle&quot; \\\n  -H &quot;X-API-Key: qsapi_YOUR_KEY&quot;<\/pre><\/div><div class=\"qs-d-code\" data-qs-hover=\"code\"><div class=\"qs-d-code__hdr\">Response &middot; 200 OK &middot; application\/json<\/div><pre class=\"qs-d-code__body\">{\n  <span class=\"k\">&quot;columns&quot;<\/span>: [ { <span class=\"k\">&quot;name&quot;<\/span>: <span class=\"s\">&quot;date&quot;<\/span>, <span class=\"k\">&quot;type&quot;<\/span>: <span class=\"s\">&quot;integer&quot;<\/span> }, { <span class=\"k\">&quot;name&quot;<\/span>: <span class=\"s\">&quot;sessions&quot;<\/span>, <span class=\"k\">&quot;type&quot;<\/span>: <span class=\"s\">&quot;string&quot;<\/span> }, { <span class=\"k\">&quot;name&quot;<\/span>: <span class=\"s\">&quot;total_users&quot;<\/span>, <span class=\"k\">&quot;type&quot;<\/span>: <span class=\"s\">&quot;string&quot;<\/span> } ],\n  <span class=\"k\">&quot;rows&quot;<\/span>: [\n    { <span class=\"k\">&quot;date&quot;<\/span>: <span class=\"n\">1042<\/span>, <span class=\"k\">&quot;sessions&quot;<\/span>: <span class=\"s\">&quot;Northwind Traders&quot;<\/span>, <span class=\"k\">&quot;total_users&quot;<\/span>: <span class=\"s\">&quot;Seattle&quot;<\/span> },\n    { <span class=\"k\">&quot;date&quot;<\/span>: <span class=\"n\">1057<\/span>, <span class=\"k\">&quot;sessions&quot;<\/span>: <span class=\"s\">&quot;Alpine Outfitters&quot;<\/span>, <span class=\"k\">&quot;total_users&quot;<\/span>: <span class=\"s\">&quot;Denver&quot;<\/span> },\n    { <span class=\"k\">&quot;date&quot;<\/span>: <span class=\"n\">1063<\/span>, <span class=\"k\">&quot;sessions&quot;<\/span>: <span class=\"s\">&quot;Harbour Foods&quot;<\/span>, <span class=\"k\">&quot;total_users&quot;<\/span>: <span class=\"s\">&quot;Halifax&quot;<\/span> }\n  ],\n  <span class=\"k\">&quot;meta&quot;<\/span>: { <span class=\"k\">&quot;row_count&quot;<\/span>: <span class=\"n\">3<\/span>, <span class=\"k\">&quot;agent_duration_ms&quot;<\/span>: <span class=\"n\">41<\/span>, <span class=\"k\">&quot;request_id&quot;<\/span>: <span class=\"s\">&quot;req_7Hq2mKd9&quot;<\/span> }\n}<\/pre><\/div><p>Rows come back as objects keyed by column name, with the column list and a <code>meta<\/code> block that tells you how many rows there are, whether the result was clipped, and the request id you can quote to support. The same call as a POST puts the parameters in a JSON body, which is the right choice for long lists of values:<\/p><div class=\"qs-d-code\" data-qs-hover=\"code\"><div class=\"qs-d-code__hdr\">POST &middot; parameters in a JSON body<\/div><pre class=\"qs-d-code__body\">curl -X POST &quot;https:\/\/api.querystreams.com\/v1\/endpoints\/8f2c4d1e-6b3a-4f7e-9c21-5d0a7b3e2f19&quot; \\\n  -H &quot;X-API-Key: qsapi_YOUR_KEY&quot; \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -d &#039;{&quot;params&quot;: {&quot;total_users&quot;: &quot;Seattle&quot;}}&#039;<\/pre><\/div><dl class=\"qs-d-kv\"><dt><code>?format=csv<\/code><\/dt><dd>CSV instead of JSON, header row included. <code>Accept: text\/csv<\/code> does the same. Streaming endpoints return NDJSON (one JSON object per line) with a final <code>{\"_summary\": true, \"row_count\": N}<\/code> line; check that last line.<\/dd><dt><code>?sample=true<\/code><\/dt><dd>At most five rows, not billed. Good for wiring up a client.<\/dd><dt><code>?compression=lz4<\/code><\/dt><dd>An LZ4-frame body for high-volume callers with a decoder; the <strong>Code<\/strong> tab has the decoder snippet per language. Plain gzip happens on its own when your client sends <code>Accept-Encoding: gzip<\/code>.<\/dd><dt><code>Authorization: Bearer qsapi_\u2026<\/code><\/dt><dd>Accepted as an alias for <code>X-API-Key<\/code>. Use it from browser code.<\/dd><\/dl>\n\n<h2 id=\"use\">Where it plugs in<\/h2>\n<div class=\"qs-d-grid\" data-qs-seen=\"use\"><div class=\"qs-d-card\" data-zone=\"dst\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-table\"><\/i><\/span><h3>Excel and Power BI<\/h3><p><strong>Export &rarr; Power Query M (.pq)<\/strong> gives you a ready-made query. Paste it into the Advanced Editor (Excel: Data &rarr; Get Data &rarr; From Other Sources &rarr; Blank Query; Power BI: Home &rarr; Transform data &rarr; New Source &rarr; Blank Query) and replace the placeholder with your <code>qsapi_<\/code> key.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"slate\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-flask\"><\/i><\/span><h3>Postman, Insomnia, Hoppscotch<\/h3><p>The same <strong>Export<\/strong> menu downloads a Postman v2.1 collection, an Insomnia v5 export or a Hoppscotch collection with the parameters filled in and a placeholder for the key.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"mint\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-code\"><\/i><\/span><h3>Your own code<\/h3><p>The <strong>Code<\/strong> tab has working samples for cURL, Python, JavaScript, TypeScript, Java, C#, Go, PHP, PowerShell and Ruby. <strong>Export &rarr; OpenAPI 3.1 spec<\/strong> feeds any client generator or Swagger UI.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"src\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-robot\"><\/i><\/span><h3>n8n, Zapier, Make, cron<\/h3><p>Create a <strong>Service key<\/strong> for the tool, paste the URL and the key into its HTTP node, and schedule it. Each tool gets its own key, so you can revoke one without touching the others.<\/p><\/div><\/div>\n\n<h2 id=\"plans\">What the plans allow<\/h2>\n<div class=\"qs-d-table__wrap\"><table class=\"qs-d-table qs-d-table--api\" data-qs-seen=\"limits\"><thead><tr><th>Plan<\/th><th>Endpoints<\/th><th>Keys per endpoint<\/th><th>People per endpoint<\/th><th>Rows per call (static)<\/th><th>Rows per call (streaming)<\/th><th>Calls per minute, per key<\/th><\/tr><\/thead><tbody><tr><td>Free<\/td><td>1<\/td><td>2<\/td><td>1<\/td><td>250<\/td><td>250<\/td><td>3<\/td><\/tr><tr><td>Personal Core<\/td><td>2<\/td><td>3<\/td><td>2<\/td><td>5,000<\/td><td>250,000<\/td><td>15<\/td><\/tr><tr><td>Personal Plus<\/td><td>5<\/td><td>5<\/td><td>5<\/td><td>10,000<\/td><td>500,000<\/td><td>30<\/td><\/tr><tr><td>Business Core<\/td><td>5<\/td><td>10<\/td><td>10<\/td><td>50,000<\/td><td>1,000,000<\/td><td>300<\/td><\/tr><tr><td>Business Plus<\/td><td>10<\/td><td>20<\/td><td>25<\/td><td>100,000<\/td><td>5,000,000<\/td><td>600<\/td><\/tr><tr><td>Business Max<\/td><td>25<\/td><td>30<\/td><td>50<\/td><td>250,000<\/td><td>10,000,000<\/td><td>600<\/td><\/tr><tr><td>Enterprise Core<\/td><td>50<\/td><td>50<\/td><td>100<\/td><td>500,000<\/td><td>25,000,000<\/td><td>1,000<\/td><\/tr><tr><td>Enterprise Plus<\/td><td>100<\/td><td>100<\/td><td>250<\/td><td>1,000,000<\/td><td>50,000,000<\/td><td>1,000<\/td><\/tr><tr><td>Enterprise Max<\/td><td>250<\/td><td>200<\/td><td>500<\/td><td>2,500,000<\/td><td>100,000,000<\/td><td>1,500<\/td><\/tr><\/tbody><\/table><\/div><p>Every call also has a fixed 60-second query timeout and an 8 MiB response cap, and the bytes it returns count against your plan&rsquo;s monthly data allowance, the same allowance the Excel and Google Sheets add-ins use. Free has one endpoint and 5 MB a month, which comfortably covers a small table called many times a day. <a href=\"https:\/\/querystreams.com\/pricing\/\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"pricing\">See the pricing page<\/a> for the allowances by plan.<\/p><div class=\"qs-d-note\" data-zone=\"mint\"><i class=\"fa-solid fa-gift\"><\/i><p><strong>Free is a plan you keep.<\/strong> It is not a trial that expires. See exactly what it includes on the <a href=\"https:\/\/querystreams.com\/pricing\/\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"pricing\">pricing page<\/a>.<\/p><\/div>\n\n<h2 id=\"safety\">Keeping it safe<\/h2>\n<div class=\"qs-d-grid\" data-qs-seen=\"safety\"><div class=\"qs-d-card\" data-zone=\"src\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-eye-slash\"><\/i><\/span><h3>The SQL stays yours<\/h3><p>Callers get rows. They never see the query, the table names or the connection details, and they cannot change what the endpoint runs.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"dst\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-key\"><\/i><\/span><h3>One key, one endpoint, one caller<\/h3><p>A key works for exactly one endpoint. Give each person or tool their own, and every call is logged against it. Revoke one and the others keep working; revocation takes effect within about five minutes.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"mint\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-lock\"><\/i><\/span><h3>Read-only, on your side of the wall<\/h3><p>The Agent runs the one saved SELECT and nothing else, from inside your network, over its own outbound connection. There is no port to open and no credential on the internet.<\/p><\/div><div class=\"qs-d-card\" data-zone=\"slate\"><span class=\"qs-d-card__bar\"><\/span><span class=\"qs-d-chip\"><i class=\"fa-solid fa-list-check\"><\/i><\/span><h3>Every call in the ledger<\/h3><p>The <strong>Activity<\/strong> tab shows each call with time, recipient, status, rows, bytes and duration, including refused ones. Set an <strong>Expiring<\/strong> lifespan for a temporary share and the endpoint switches itself off on the date.<\/p><\/div><\/div>\n\n<h2 id=\"trouble\">When something doesn&rsquo;t work<\/h2>\n<div class=\"qs-d-table__wrap\"><table class=\"qs-d-table qs-d-table--api\" data-qs-seen=\"trouble\"><thead><tr><th>Status<\/th><th>Code<\/th><th>What to do<\/th><\/tr><\/thead><tbody><tr><td>401<\/td><td><code>API_KEY_REQUIRED \/ API_KEY_INVALID<\/code><\/td><td>The header is missing or the key is wrong. Send <code>X-API-Key: qsapi_\u2026<\/code>, the whole 49 characters. Keys can be copied again from the endpoint&rsquo;s Sharing tab.<\/td><\/tr><tr><td>403<\/td><td><code>API_KEY_ENDPOINT_MISMATCH<\/code><\/td><td>A valid key used on a different endpoint. Each key belongs to one endpoint.<\/td><\/tr><tr><td>403<\/td><td><code>API_KEY_REVOKED \/ API_ENDPOINT_EXPIRED<\/code><\/td><td>The key was revoked or the endpoint reached its expiry date. Mint a new key or restore the endpoint.<\/td><\/tr><tr><td>400<\/td><td><code>API_PARAM_NOT_OVERRIDABLE<\/code><\/td><td>You sent a parameter the owner did not mark Callable. The body lists the allowed names.<\/td><\/tr><tr><td>414<\/td><td><code>API_QUERY_TOO_LARGE<\/code><\/td><td>The GET query string passed 8 KB or 200 list values. Send the same parameters as a POST JSON body.<\/td><\/tr><tr><td>413<\/td><td><code>API_OUTPUT_TOO_LARGE<\/code><\/td><td>The result passed the 8 MiB cap. Narrow the query, or switch the endpoint to Streaming.<\/td><\/tr><tr><td>429<\/td><td><code>API_RATE_LIMITED<\/code><\/td><td>Too many calls this minute for the key or the endpoint. Wait for the <code>Retry-After<\/code> seconds, or raise <strong>Rate limit<\/strong> under API Settings &rarr; Defaults within your plan.<\/td><\/tr><tr><td>429<\/td><td><code>API_DATA_REALM_EXHAUSTED<\/code><\/td><td>The owner&rsquo;s monthly data allowance is used up. It resets with the billing month; upgrade for more.<\/td><\/tr><tr><td>503<\/td><td><code>API_AGENT_NOT_CONNECTED<\/code><\/td><td>The Agent behind your GA4 account is offline. Check it under Data &rarr; Data Agents; calls succeed again as soon as it reconnects.<\/td><\/tr><tr><td>504<\/td><td><code>API_QUERY_TIMEOUT<\/code><\/td><td>The query took longer than 60 seconds. Add a filter or an index, or save a narrower query.<\/td><\/tr><\/tbody><\/table><\/div><p>Every error body has the shape <code>{\"error\": {\"code\": \"\u2026\", \"message\": \"\u2026\"}}<\/code> and every response carries an <code>X-QS-Request-Id<\/code> header. Quote the id when you write to support.<\/p>\n\n<h2 id=\"faq\">Questions people ask<\/h2>\n<div class=\"qs-d-faq\" data-qs-seen=\"faq\"><details><summary>Does my data get copied to Query Streams?<\/summary><div class=\"qs-d-faq__a\"><p>No. The Agent runs the query where your data is and sends only the rows the call asked for. Nothing is synced or cached in between; every call runs the query.<\/p><\/div><\/details><details><summary>Can callers change the SQL or ask for other tables?<\/summary><div class=\"qs-d-faq__a\"><p>No. An endpoint runs one saved query. Callers can only set the parameters you marked <strong>Callable<\/strong>, and the values are bound safely: text is quoted and escaped, numbers are range-checked, lists are expanded.<\/p><\/div><\/details><details><summary>How do I hand this to a partner?<\/summary><div class=\"qs-d-faq__a\"><p>On the endpoint&rsquo;s <strong>Sharing<\/strong> tab choose <strong>People<\/strong> and enter their email. They get a magic link, sign in with that address (a Free account is fine) and mint their own key; you see their calls by name on the Activity tab. For a server or an automation tool, create an <strong>API key<\/strong> with a label instead.<\/p><\/div><\/details><details><summary>What happens when I edit the saved query?<\/summary><div class=\"qs-d-faq__a\"><p>The endpoint runs the new SQL on the next call and its OpenAPI spec regenerates. The URL and the keys do not change. If you add or remove a filter, revisit <strong>Lock params<\/strong> so callers see the right parameters.<\/p><\/div><\/details><details><summary>Does the Free plan really cover this?<\/summary><div class=\"qs-d-faq__a\"><p>Yes. Free is a plan you keep, not a trial that expires. It includes one endpoint, two keys and 250 rows per call. See exactly what it includes on the <a href=\"https:\/\/querystreams.com\/pricing\/\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"pricing\">pricing page<\/a>.<\/p><\/div><\/details><\/div>\n<div class=\"qs-d-faq\">\n    <details><summary>Does the endpoint speak GA4&rsquo;s SQL dialect?<\/summary><div class=\"qs-d-faq__a\"><p>Yes, because the SQL is yours. You wrote and ran it against your GA4 account in Query Builder; the endpoint runs that exact statement through the same connection, with your parameter values bound in the way GA4 expects.<\/p><\/div><\/details>\n    <details><summary>Does my GA4 account have to be reachable from the internet?<\/summary><div class=\"qs-d-faq__a\"><p>No. Only the Agent has to reach it, from any always-on computer with internet access. The Agent makes one outbound connection to Query Streams; callers talk to api.querystreams.com and never to your server.<\/p><\/div><\/details>\n<\/div>\n\n<div class=\"qs-d-support qs-d-support--foot\" data-zone=\"mint\" data-qs-seen=\"support\"><span class=\"qs-d-chip\"><i class=\"fa-solid fa-life-ring\"><\/i><\/span><div class=\"qs-d-support__body\"><strong>Still stuck?<\/strong> Open <a href=\"https:\/\/my.querystreams.com\/support\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"support\">Support<\/a> in Query Streams and tell us which step you are on and what you see. We will get you connected.<\/div><\/div>\n<div class=\"qs-d-cta\"><a class=\"qs-d-btn qs-d-btn--primary\" href=\"https:\/\/my.querystreams.com\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"signup\"><i class=\"fa-solid fa-user-plus\"><\/i> Create your Free plan account<\/a><a class=\"qs-d-btn qs-d-btn--ghost\" href=\"https:\/\/querystreams.com\/pricing\/\" target=\"_blank\" rel=\"noopener\" data-qs-cta=\"pricing\">See what Free includes<\/a><\/div>\n\n<h2 id=\"related\">Related guides<\/h2>\n<ul class=\"qs-d-related\">\n    <li><a href=\"https:\/\/querystreams.com\/docs\/how-to-connect-google-analytics-to-google-sheets\/\" data-qs-cta=\"related\">How to connect Google Analytics 4 to Google Sheets<\/a><\/li>\n    <li><a href=\"https:\/\/querystreams.com\/docs\/how-to-query-google-analytics-4-with-claude-via-mcp\/\" data-qs-cta=\"related\">Connect Google Analytics 4 to Claude with MCP<\/a><\/li>\n    <li><a href=\"https:\/\/querystreams.com\/docs\/instant-rest-api-for-sql-databases\/\" data-qs-cta=\"related\">Database REST API: Turn Any SQL Query into an Endpoint<\/a><\/li>\n    <li><a href=\"https:\/\/querystreams.com\/docs\/expose-sql-server-as-rest-api\/\" data-qs-cta=\"related\">Microsoft SQL Server REST API<\/a><\/li>\n    <li><a href=\"https:\/\/querystreams.com\/docs\/expose-postgresql-as-rest-api\/\" data-qs-cta=\"related\">PostgreSQL REST API<\/a><\/li>\n    <li><a href=\"https:\/\/querystreams.com\/docs\/expose-mysql-as-rest-api\/\" data-qs-cta=\"related\">MySQL REST API<\/a><\/li>\n<\/ul>\n<div class=\"qs-d-also\" data-qs-seen=\"also\"><span>The same GA4 connection also feeds<\/span><a href=\"https:\/\/querystreams.com\/features\/databases-in-excel-and-google-sheets\/\" target=\"_blank\" rel=\"noopener\">Excel and Google Sheets<\/a><a href=\"https:\/\/querystreams.com\/docs\/how-to-query-google-analytics-4-with-claude-via-mcp\/\">Claude and other AI tools<\/a><a href=\"https:\/\/querystreams.com\/features\/automation-integration\/\" target=\"_blank\" rel=\"noopener\">scheduled Automations<\/a><a href=\"https:\/\/querystreams.com\/features\/\" target=\"_blank\" rel=\"noopener\">and more<\/a><\/div>\n<\/article>\n<script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"HowTo\",\"name\":\"Google Analytics 4 Data REST API: turn a SQL query into an endpoint\",\"description\":\"Turn a saved GA4 SQL query into a read-only REST API endpoint with Query Streams: no server to host, one key per caller, the SQL kept private.\",\"totalTime\":\"PT2M\",\"step\":[{\"@type\":\"HowToStep\",\"position\":1,\"name\":\"Save the query\",\"text\":\"In Query Builder write and run the SELECT against your GA4 account, then save it. Add a Dynamic Filter if callers should be able to filter.\",\"url\":\"https:\/\/querystreams.com\/docs\/google-analytics-4-data-rest-api\/#step-1\"},{\"@type\":\"HowToStep\",\"position\":2,\"name\":\"Create the endpoint\",\"text\":\"Open API, click New endpoint, pick the saved query and click Next.\",\"url\":\"https:\/\/querystreams.com\/docs\/google-analytics-4-data-rest-api\/#step-2\"},{\"@type\":\"HowToStep\",\"position\":3,\"name\":\"Configure and lock parameters\",\"text\":\"Keep Permanent, Static and JSON, mark the filters callers may set as Callable, and click Next.\",\"url\":\"https:\/\/querystreams.com\/docs\/google-analytics-4-data-rest-api\/#step-3\"},{\"@type\":\"HowToStep\",\"position\":4,\"name\":\"Share and get your key\",\"text\":\"Click Create & get my key, copy the key, and invite people or create a service key on the Sharing tab.\",\"url\":\"https:\/\/querystreams.com\/docs\/google-analytics-4-data-rest-api\/#step-4\"}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"doc_category":[244],"doc_tag":[],"class_list":["post-6883","docs","type-docs","status-publish","hentry","doc_category-api-platform"],"year_month":"2026-12","word_count":922,"total_views":"34","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"systemz","author_nicename":"systemz","author_url":"https:\/\/querystreams.com\/fr\/author\/systemz\/"},"doc_category_info":[{"term_name":"Database REST API","term_url":"https:\/\/querystreams.com\/fr\/docs-category\/api-platform\/"}],"doc_tag_info":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"trp-custom-language-flag":false,"betterdocs-category-thumb":false},"uagb_author_info":{"display_name":"systemz","author_link":"https:\/\/querystreams.com\/fr\/author\/systemz\/"},"uagb_comment_info":0,"uagb_excerpt":null,"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/docs\/6883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/comments?post=6883"}],"version-history":[{"count":1,"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/docs\/6883\/revisions"}],"predecessor-version":[{"id":8087,"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/docs\/6883\/revisions\/8087"}],"wp:attachment":[{"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/media?parent=6883"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/doc_category?post=6883"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/querystreams.com\/fr\/wp-json\/wp\/v2\/doc_tag?post=6883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}