Skip to content

Instantly share code, notes, and snippets.

@vikychoi
Created March 1, 2026 01:45
Show Gist options
  • Select an option

  • Save vikychoi/a5ffe131980518087b076f9eadb9b336 to your computer and use it in GitHub Desktop.

Select an option

Save vikychoi/a5ffe131980518087b076f9eadb9b336 to your computer and use it in GitHub Desktop.
Do something with only the Google API key
API_KEY = ""
EMAIL = ""
PASSWORD = ""
PHONE = ""
BASE = "https://identitytoolkit.googleapis.com/v1"
def post(url, data):
    r = requests.post(url, json=data)
    print(f"\n[{url.split('/')[-1].split('?')[0]}] {r.status_code}")
    print(r.json())
def get(url, params):
    r = requests.get(url, params=params)
    print(f"\n[{url.split('/')[-1].split('?')[0]}] {r.status_code}")
    try:
        print(r.json())
    except:
        print(r.text)
print("\n=== Identity Platform Auth Methods ===")
post(f"{BASE}/accounts:signUp?key={API_KEY}", {"returnSecureToken": True})
post(f"{BASE}/accounts:signUp?key={API_KEY}", {"email": EMAIL, "password": PASSWORD, "returnSecureToken": True})
post(f"{BASE}/accounts:signInWithPassword?key={API_KEY}", {"email": EMAIL, "password": PASSWORD, "returnSecureToken": True})
post(f"{BASE}/accounts:createAuthUri?key={API_KEY}", {"identifier": EMAIL, "continueUri": "http://localhost"})
post(f"{BASE}/accounts:sendOobCode?key={API_KEY}", {"requestType": "PASSWORD_RESET", "email": EMAIL})
post(f"{BASE}/accounts:sendOobCode?key={API_KEY}", {"requestType": "EMAIL_SIGNIN", "email": EMAIL})
post(f"{BASE}/accounts:signInWithEmailLink?key={API_KEY}", {"email": EMAIL, "oobCode": "OOB_CODE"})
post(f"{BASE}/accounts:sendVerificationCode?key={API_KEY}", {"phoneNumber": PHONE, "recaptchaToken": "RECAPTCHA_TOKEN"})
print("\n=== Google Maps APIs ===")
get("https://maps.googleapis.com/maps/api/geocode/json", {"address": "New York", "key": API_KEY})
get("https://maps.googleapis.com/maps/api/directions/json", {"origin": "New York", "destination": "Boston", "key": API_KEY})
get("https://maps.googleapis.com/maps/api/distancematrix/json", {"origins": "New York", "destinations": "Boston", "key": API_KEY})
get("https://maps.googleapis.com/maps/api/place/nearbysearch/json", {"location": "40.7128,-74.0060", "radius": 1000, "key": API_KEY})
get("https://maps.googleapis.com/maps/api/place/textsearch/json", {"query": "restaurants in New York", "key": API_KEY})
get("https://maps.googleapis.com/maps/api/place/details/json", {"place_id": "ChIJN1t_tDeuEmsRUsoyG83frY4", "key": API_KEY})
get("https://maps.googleapis.com/maps/api/place/autocomplete/json", {"input": "New York", "key": API_KEY})
get("https://maps.googleapis.com/maps/api/elevation/json", {"locations": "40.7128,-74.0060", "key": API_KEY})
get("https://maps.googleapis.com/maps/api/timezone/json", {"location": "40.7128,-74.0060", "timestamp": 1458000000, "key": API_KEY})
get("https://roads.googleapis.com/v1/snapToRoads", {"path": "40.7128,-74.0060", "key": API_KEY})
print("\n=== YouTube APIs ===")
get("https://www.googleapis.com/youtube/v3/search", {"part": "snippet", "q": "test", "key": API_KEY})
get("https://www.googleapis.com/youtube/v3/videos", {"part": "snippet", "chart": "mostPopular", "key": API_KEY})
get("https://www.googleapis.com/youtube/v3/channels", {"part": "snippet", "forUsername": "Google", "key": API_KEY})
get("https://www.googleapis.com/youtube/v3/playlists", {"part": "snippet", "channelId": "UCVHFbw7woebKtHQFCiPXjcQ", "key": API_KEY})
get("https://www.googleapis.com/youtube/v3/commentThreads", {"part": "snippet", "videoId": "dQw4w9WgXcQ", "key": API_KEY})
print("\n=== Translation & Language APIs ===")
get("https://translation.googleapis.com/language/translate/v2", {"q": "hello", "target": "es", "key": API_KEY})
get("https://translation.googleapis.com/language/translate/v2/detect", {"q": "Bonjour", "key": API_KEY})
get("https://translation.googleapis.com/language/translate/v2/languages", {"key": API_KEY})
print("\n=== Custom Search ===")
get("https://www.googleapis.com/customsearch/v1", {"q": "test", "key": API_KEY})
print("\n=== Cloud Natural Language ===")
post(f"https://language.googleapis.com/v1/documents:analyzeSentiment?key={API_KEY}", {"document": {"type": "PLAIN_TEXT", "content": "I love Google!"}})
post(f"https://language.googleapis.com/v1/documents:analyzeEntities?key={API_KEY}", {"document": {"type": "PLAIN_TEXT", "content": "Google was founded by Larry Page."}})
post(f"https://language.googleapis.com/v1/documents:classifyText?key={API_KEY}", {"document": {"type": "PLAIN_TEXT", "content": "Google is a technology company."}})
print("\n=== Cloud Vision ===")
post(f"https://vision.googleapis.com/v1/images:annotate?key={API_KEY}", {"requests": [{"image": {"source": {"imageUri": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Culinary_fruits_front_view.jpg/1200px-Culinary_fruits_front_view.jpg"}}, "features": [{"type": "LABEL_DETECTION"}]}]})
print("\n=== Firebase Project Discovery ===")
r = requests.get(f"https://identitytoolkit.googleapis.com/v1/projects?key={API_KEY}")
print(f"\n[projects] {r.status_code}")
data = r.json()
print(data)
project_id = None
if "projectId" in data:
    project_id = data["projectId"]
elif "projects" in data:
    for p in data["projects"]:
        project_id = p.get("projectId")
print("\n=== Firebase Realtime Database ===")
if project_id:
    get(f"https://{project_id}.firebaseio.com/.json", {"auth": API_KEY})
    get(f"https://{project_id}-default-rtdb.firebaseio.com/.json", {"auth": API_KEY})
else:
    print("Could not determine project ID")
print("\n=== PageSpeed / Web APIs ===")
get("https://www.googleapis.com/pagespeedonline/v5/runPagespeed", {"url": "https://google.com", "key": API_KEY})
print("\n=== Books API ===")
get("https://www.googleapis.com/books/v1/volumes", {"q": "python programming", "key": API_KEY})
print("\n=== Calendar API ===")
get("https://www.googleapis.com/calendar/v3/calendars/primary/events", {"key": API_KEY})
print("\n=== Blogger API ===")
get("https://www.googleapis.com/blogger/v3/blogs/byurl", {"url": "https://buzz.blogger.com", "key": API_KEY})
# https://trufflesecurity.com/blog/google-api-keys-werent-secrets-but-then-gemini-changed-the-rules
print("\n=== generativelanguage ===")
get("https://generativelanguage.googleapis.com/v1beta/files", {"key": API_KEY})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment