Browse documentation
Get started
Call Google Search and YouTube APIs directly over HTTP. Send one request and read the JSON response; no SDK is required.
Authenticate
Create an account, verify your email and create a key with Google Search permission. You can reuse an existing key.
Run this in your terminal and paste your key at the hidden prompt. Skip it if FLASHDATA_API_KEY is already set.
Set your key# Bash: paste the key into a hidden prompt, not into this command. read -r -s -p "FlashData API key: " FLASHDATA_API_KEY printf '\n' export FLASHDATA_API_KEYSet your key# PowerShell 7: paste the key into a hidden prompt. $flashdataSecureKey = Read-Host "FlashData API key" -AsSecureString $env:FLASHDATA_API_KEY = [System.Net.NetworkCredential]::new("", $flashdataSecureKey).Password Remove-Variable flashdataSecureKeyRun a search
Choose a client and run the example in the same terminal. Each sends one POST request to https://data.flashdata.dev/v1/queries/realtime and prints JSON. Authenticate with X-API-Key; send JSON with Content-Type: application/json.
cURL 7.76+ · Bash on Linux, macOS or Git Bash. Paste and run.
Search · Bash / cURLcurl --fail-with-body --silent --show-error --max-time 70 \ --request POST https://data.flashdata.dev/v1/queries/realtime \ --header "X-API-Key: $FLASHDATA_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "source": "google_search", "query": "battery recycling research", "params": { "num": 5 } }'PowerShell 7+ · Paste this native PowerShell command.
Search · PowerShell$flashdataRequest = '{"source":"google_search","query":"battery recycling research","params":{"num":5}}' $flashdataSearch = @{ Uri = 'https://data.flashdata.dev/v1/queries/realtime' Method = 'Post' Headers = @{ 'X-API-Key' = $env:FLASHDATA_API_KEY } ContentType = 'application/json' Body = $flashdataRequest TimeoutSec = 70 MaximumRedirection = 0 SkipHttpErrorCheck = $true ErrorAction = 'Stop' } $flashdataResponse = Invoke-WebRequest @flashdataSearch $flashdataResponse.Content if ($flashdataResponse.StatusCode -ge 400) { throw "HTTP $($flashdataResponse.StatusCode). Inspect the response above before retrying." }Node.js 22+ · Save as search.mjs and run locally or on your server. Uses built-in fetch; no npm install.
search.mjsconst key = process.env.FLASHDATA_API_KEY; if (!key) throw new Error("Set FLASHDATA_API_KEY in this terminal."); let response; try { response = await fetch("https://data.flashdata.dev/v1/queries/realtime", { method: "POST", redirect: "error", signal: AbortSignal.timeout(70000), headers: { "X-API-Key": key, "Content-Type": "application/json" }, body: JSON.stringify({"source":"google_search","query":"battery recycling research","params":{"num":5}}), }); } catch { throw new Error("Request did not complete. Check History before resubmitting."); } const body = await response.text(); console.log(body); // Print the full response before checking its status. if (!response.ok) { const retryAfter = response.headers.get("retry-after"); throw new Error("HTTP " + response.status + ". See the response above." + (retryAfter ? " Retry-After: " + retryAfter : "")); } let result; try { result = JSON.parse(body); } catch { throw new Error("Expected JSON. Inspect the response above and the API URL."); } if (!result || result.error === true || result.status !== "done" || !Array.isArray(result.results)) { throw new Error("Query did not succeed. Inspect status and error in the response above."); }Run · JavaScriptnode search.mjsPython 3.10+ · Save as search.py. Uses only the standard library; no pip install. Use python3 or py -3 if that is your Python command.
search.pyimport json import os import urllib.error import urllib.request key = os.environ.get("FLASHDATA_API_KEY") if not key: raise SystemExit("Set FLASHDATA_API_KEY in this terminal.") # Do not forward the API key to a redirect destination. class NoRedirect(urllib.request.HTTPRedirectHandler): def redirect_request(self, req, fp, code, msg, headers, newurl): return None request = urllib.request.Request( "https://data.flashdata.dev/v1/queries/realtime", data=json.dumps({"source":"google_search","query":"battery recycling research","params":{"num":5}}).encode("utf-8"), headers={"X-API-Key": key, "Content-Type": "application/json"}, method="POST", ) try: with urllib.request.build_opener(NoRedirect).open(request, timeout=70) as response: body = response.read().decode("utf-8") except urllib.error.HTTPError as error: print(error.read().decode("utf-8", errors="replace")) retry_after = error.headers.get("Retry-After") raise SystemExit("HTTP " + str(error.code) + ". See the response above." + (" Retry-After: " + retry_after if retry_after else "")) except (urllib.error.URLError, TimeoutError): raise SystemExit("Request did not complete. Check History before resubmitting.") print(body) # The run command saves this full response to result.json. try: result = json.loads(body) except json.JSONDecodeError: raise SystemExit("Expected JSON. Inspect the response above and the API URL.") if (not isinstance(result, dict) or result.get("error") is True or result.get("status") != "done" or not isinstance(result.get("results"), list)): raise SystemExit("Query did not succeed. Inspect status and error in the response above.")Run · Pythonpython -X utf8 search.pyCheck the result
Confirm HTTP success and status: done. Read source titles, links and snippets in results[].organic, and the charge in usage.credits.
An empty results or organic list with status: done is a valid empty result.
Example response{ "source": "google_search", "status": "done", "results": [ { "organic": [ { "title": "Battery recycling research", "link": "https://example.org/recycling", "snippet": "An example search excerpt." } ] } ], "usage": { "credits": 0.02 } }status- "done" confirms the query finished successfully.
results[0].organic[]- Search results. Check that results is nonempty before indexing it.
title / link / snippet- Source title, URL and excerpt.
usage.credits- Actual credits charged for this query.
Save a response for debugging
To capture the next intended request, add these options to the cURL command above. Inspect the files before deciding to retry a failed request.
--dump-header response-headers.txt --output result.jsonCheck access and credits
These GET requests read identity, balance and pricing without using query credits. Expect HTTP 200 and check the fields below before submitting paid work.
Account reads: https://api.flashdata.dev/v2. Data requests: https://data.flashdata.dev/v1. Both use X-API-Key; JSON POST requests also use Content-Type: application/json.
(
for endpoint in 'identity' 'balance' 'pricing?source=google_search&request_count=1'; do
printf '\n%s\n' "$endpoint"
curl --fail-with-body --silent --show-error --max-time 20 \
--header "X-API-Key: $FLASHDATA_API_KEY" \
--write-out '\nHTTP %{http_code}\n' \
"https://api.flashdata.dev/v2/api-access/$endpoint" || exit
done
)try {
foreach ($flashdataPath in @('identity', 'balance', 'pricing?source=google_search&request_count=1')) {
Write-Host $flashdataPath
$flashdataRead = @{
Uri = "https://api.flashdata.dev/v2/api-access/$flashdataPath"
Headers = @{ 'X-API-Key' = $env:FLASHDATA_API_KEY }
TimeoutSec = 20
MaximumRedirection = 0
ErrorAction = 'Stop'
}
Invoke-RestMethod @flashdataRead | ConvertTo-Json -Depth 20
}
} catch {
throw
}identity- Confirm the intended accountId, access: "ready", scopes containing "google_search", and any expiresAt. accountType is "owned" for an owner key or "temporary" for a trial key.
balance- Read availableCredits. All keys for this account use the same balance.
pricing- For prices[0], confirm source is google_search and available is true. Compare estimatedCredits for requestCount: 1 with availableCredits. Prices and balances can change before submission.
Next steps
If a step fails
Read the response printed in your terminal. JavaScript and Python report HTTP errors and Retry-After to stderr. Each example submits once; it does not automatically retry.
- Command missing or unsupported option
- Check the required version in the selected example. Use PowerShell 7 rather than Windows PowerShell 5.1, or use Bash with cURL 7.76+. JavaScript needs Node 22+; Python needs 3.10+. Install the missing runtime from its official download page, reopen the terminal, then set the key again.
- Missing key / 401
- Set FLASHDATA_API_KEY in this process and check identity again. Supply the full active API key, without a Bearer prefix. If it expired or was revoked, use a current authorized credential; do not paste it into chat.
- 403
- Check identity.scopes for google_search and access for ready. Request the missing permission from the owner; changing the source in the request does not grant access.
- 402
- Read balance again and compare it with the current price. The owner can review Billing. An exhausted trial needs owner access through claiming; creating a replacement trial is not recovery.
- 400 / 422
- Read the returned error message. Check the exact data host, POST method, Content-Type and JSON field names. Use straight quotes and a numeric params.num, then correct the rejected request.
- 429
- Respect Retry-After if present; otherwise use a bounded backoff and reduce concurrency. Do not loop rapidly, create new keys or register another trial to bypass the limit.
- HTTP 200 with failed status or error
- Read the error in the body and preserve any request or job ID. Do not treat a parsed JSON body as a successful task or automatically resubmit it.
- Empty results
- If status is done, authentication worked. Keep the empty result or try a broader query as a new paid request.
- Timeout, connection loss, 5xx or HTML instead of JSON
- A POST may have been accepted even if its response was lost. Check History for the original query and preserve any returned IDs before deciding to resend. Free GET checks can be retried. Confirm the URL uses data.flashdata.dev, not the website host, and do not disable TLS verification.