I'm trying to build a program that can help to automate Resy reservations, given how difficult it can be to find slots at certain restaurants. I added my API key and auth token (real key and token where I inserted brackets in the code), but I keep receiving a 419 error, no matter what I do. I initially had my email and password in the code, but that didn't work either. Any help would be appreciated! -- import requests import json # === CONFIG === API_KEY = "[my API key]" # e.g. from token field in localStorage or JS var AUTH_TOKEN = "[my auth token]" # e.g. JWT from network request headers VENUE_ID = "82221" # Buddakan PARTY_SIZE = 4 BOOKING_DATE = "2025-06-23" COMMON_HEADERS = { "User-Agent": "Mozilla/5.0", "Origin": "https://resy.com", "Referer": "https://resy.com/", "X-Resy-API-Version": "1", "Content-Type": "application/json", "Authorization": f"ResyAPI api_key={API_KEY}", "X-Resy-Auth-Token": AUTH_TOKEN } # === STEP 1: Search for available slots === def search_slot(): print(" Searching for available slots...") url = f"https://api.resy.com/4/find?day={BOOKING_DATE}&party_size={PARTY_SIZE}&venue_id={VENUE_ID}" res = requests.get(url, headers=COMMON_HEADERS) res.raise_for_status() venues = res.json().get("results", {}).get("venues", []) if not venues or not venues[0].get("slots"): raise Exception("❌ No slots found.") token = venues[0]["slots"][0]["config"]["token"] print(f"✅ Found booking token: {token}") return token # === STEP 2: Get payment method === def get_payment_method(): print(" Getting saved payment method...") res = requests.get("https://api.resy.com/3/paymentmethods", headers=COMMON_HEADERS) res.raise_for_status() cards = res.json()["payload"]["payment_methods"] if not cards: raise Exception("❌ No payment methods found.") payment_id = cards[0]["id"] print(f"✅ Using payment method ID: {payment_id}") return payment_id # === STEP 3: Book the reservation === def book_table(book_token, payment_id): print(" Booking reservation...") body = { "book_token": book_token, "struct_payment_method": {"id": payment_id}, "source_id": "resy.com-venue-details" } res = requests.post("https://api.resy.com/3/book", headers=COMMON_HEADERS, json=body) res.raise_for_status() print(" Booking confirmed!") print(json.dumps(res.json(), indent=2)) # === RUN SCRIPT === if __name__ == "__main__": try: book_token = search_slot() payment_id = get_payment_method() book_table(book_token, payment_id) except Exception as e: print(f"❌ Error: {e}") Continue reading...