Browse documentation
Get started
Run your first Google search and get structured results for your app or AI agent.
Start with your AI agent
Give this prompt to an agent with terminal access. It sets up FlashData and runs one search.
Read https://flashdata.dev/auth.md and follow the FlashData setup instructions for this environment. Reuse existing access; if none exists, start one eligible trial. Search Google for "battery recycling research" with up to five results. Return source titles, URLs and actual credits used. Keep credentials in protected storage, not chat. If access is blocked, report the next step instead of creating another trial.
Make your first API call
Prefer to write the code? Follow these three steps in your terminal.
Get an API key
Create an account, verify your email and create a key with Google Search permission. Already have a key? Use it here.
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 your language and run the example in the same terminal. Each run makes one search.
Python 3.10+ · Save the example as quickstart.py.
Installpython -m pip install "flashdata==1.1.0"quickstart.pyimport json import os from flashdata import FlashData with FlashData(api_key=os.environ["FLASHDATA_API_KEY"]) as client: response = client.google.search("battery recycling research", num=5) if response["status"] != "done": raise RuntimeError(response) print(json.dumps(response, indent=2))Runpython quickstart.pyNode.js 22.18+ · Start in an empty folder and save quickstart.mts.
Set upnpm init -y npm install --save-exact @flashdata-dev/[email protected]quickstart.mtsimport { FlashData } from '@flashdata-dev/sdk'; const apiKey = process.env.FLASHDATA_API_KEY; if (!apiKey) throw new Error('Set FLASHDATA_API_KEY first.'); const client = new FlashData({ apiKey }); const response = await client.google.search({ query: 'battery recycling research', num: 5, }); if (response.status !== 'done') throw new Error(JSON.stringify(response)); console.log(JSON.stringify(response, null, 2));Runnode quickstart.mtsNode.js 22+ · Start in an empty folder and save quickstart.mjs.
Set upnpm init -y npm install --save-exact @flashdata-dev/[email protected]quickstart.mjsimport { FlashData } from '@flashdata-dev/sdk'; const apiKey = process.env.FLASHDATA_API_KEY; if (!apiKey) throw new Error('Set FLASHDATA_API_KEY first.'); const client = new FlashData({ apiKey }); const response = await client.google.search({ query: 'battery recycling research', num: 5, }); if (response.status !== 'done') throw new Error(JSON.stringify(response)); console.log(JSON.stringify(response, null, 2));Runnode quickstart.mjsGo 1.25+ · Start in an empty folder and save main.go. Skip go mod init in an existing module.
Set upgo mod init example.com/flashdata-quickstart go get github.com/flashdatadev/[email protected]main.gopackage main import ( "context" "encoding/json" "log" "os" "time" flashdata "github.com/flashdatadev/flashdata-go" ) func main() { key := os.Getenv("FLASHDATA_API_KEY") if key == "" { log.Fatal("Set FLASHDATA_API_KEY through your server's secret manager.") } client, err := flashdata.New(flashdata.Options{APIKey: key}) if err != nil { log.Fatal(err) } ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) defer cancel() result, err := client.Google.Search(ctx, flashdata.GoogleSearchInput{ Query: "battery recycling research", Params: &flashdata.GoogleSearchParams{Num: flashdata.Ptr(int64(5))}, }) if err != nil { // Do not automatically resubmit an uncertain paid request. log.Fatal(err) } if err := json.NewEncoder(os.Stdout).Encode(result); err != nil { log.Fatal(err) } if result.Status != "done" { log.Fatalf("Search did not complete: %s", result.Status) } }Rungo run .No SDK needed. Run either the Bash / cURL 7.76+ command or the PowerShell 7 command.
Bash / cURLcurl --fail-with-body --silent --show-error \ --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$flashdataRequest = '{"source":"google_search","query":"battery recycling research","params":{"num":5}}' $flashdataResult = Invoke-RestMethod -Method Post -Uri 'https://data.flashdata.dev/v1/queries/realtime' -Headers @{ 'X-API-Key' = $env:FLASHDATA_API_KEY } -ContentType 'application/json' -Body $flashdataRequest $flashdataResult | ConvertTo-Json -Depth 20Check the result
A successful response has status: done. Find sources in results[].organic and the credits charged in usage.credits.
Example response (abbreviated){ "status": "done", "results": [ { "organic": [ { "title": "Battery recycling research", "link": "https://example.org/recycling", "snippet": "An example search excerpt." } ] } ], "usage": { "credits": 0.02 } }
Try the console
- Create an account or sign in. Complete email verification and any account setup shown in the console.
- Open Google Search, select the Google Search source and Realtime mode, then enter battery recycling research. Expand Additional parameters and set Page size (num) to 5.
- Check the displayed request and available credits, then run the search once.
- Inspect the response and usage. Open a returned source to check its contents before citing more than its excerpt.
Build on your first result
If the first request fails
- Missing FLASHDATA_API_KEY
- Set the key in the same terminal or runtime as the example; .env files are not loaded by these snippets.
- 401 / 403
- Check that the key or connection is active and has google_search permission.
- 402
- Check available credits in Billing. Claim an existing trial when owner access is needed.
- 429
- Respect Retry-After. Keep the same identity and registration proof; do not create another trial.
- Timeout or unknown submission
- Check the existing run before retrying. CLI users keep the same profile and run ID; SDK/API users preserve any returned job or request ID.