Skip to content

karthikvetrivel/resy-sniper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resy Bot 🍽️

A powerful Go library and set of tools for automating Resy restaurant reservations. Search restaurants, check availability, and book reservations programmatically.

Features

  • 🔍 Search restaurants by name
  • 📅 Check availability for specific dates and party sizes
  • 🎯 Sniper mode - automatically book when slots become available
  • 🔗 URL booking - paste any Resy URL and book instantly
  • 💳 Payment support - handles payment methods automatically
  • Fast - concurrent requests and efficient polling

Quick Start

1. Installation

git clone https://github.com/kvetrivel/resy-bot.git
cd resy-bot
go mod download

2. Set Up Credentials

Copy the credentials template in the examples directory:

cd examples
cp credentials.example.yaml credentials.yaml

Edit credentials.yaml and add your Resy credentials:

api_key: "YOUR_RESY_API_KEY"        # Extract from Resy
auth_token: "YOUR_RESY_AUTH_TOKEN"  # Extract from Resy

How to get your credentials:

  1. API Key:

    • Open resy.com and log in
    • Open Developer Tools (F12 or Cmd+Option+I)
    • Go to Network tab and refresh
    • Find any request to api.resy.com
    • Look for the Authorization header
    • Copy the API key from ResyAPI api_key="..."
  2. Auth Token:

    • In the same request headers
    • Find X-Resy-Auth-Token
    • Copy the entire JWT token value

3. Run Examples

# From the examples directory
cd examples

# Search and explore the API
go run api_explorer.go

# Book from URL (easiest method)
go run book_from_url.go

# Book specific restaurant with confirmation
go run book_zensushi_safe.go

4. Run Sniper Bot

# From the project root
go run cmd/sniper/main.go

# Or build it first
go build -o sniper cmd/sniper/main.go
./sniper

Usage Examples

Book from URL

The easiest way to book. Just paste any Resy URL:

// book_from_url.go
resyURL := "https://resy.com/cities/new-york-ny/venues/idashi-omakase?date=2025-10-09&seats=2"

Run it:

go run book_from_url.go

The script will:

  1. Parse venue, date, and party size from URL
  2. Search for the restaurant
  3. Show available time slots
  4. Let you choose and confirm
  5. Book the reservation

Sniper Mode

Monitor a restaurant and instantly book when your target time becomes available (perfect for catching cancellations):

// sniper.go
venueID := 6194
date := "2025-10-20"
partySize := 2
targetTime := "19:00"
duration := 5 * time.Minute
go run sniper.go

Polls every 100ms and books immediately when found.

Library Usage

Import and use as a library in your own Go projects:

package main

import (
    "context"
    "log"
    
    resybot "github.com/kvetrivel/resy-bot/pkg/resybot"
)

func main() {
    // Load credentials from YAML
    creds, err := resybot.LoadCredentials("credentials.yaml")
    if err != nil {
        log.Fatal(err)
    }
    
    // Create client
    client := resybot.NewClient(resybot.Config{
        APIKey:    creds.APIKey,
        AuthToken: creds.AuthToken,
    })
    
    ctx := context.Background()
    
    // Search restaurants
    venues, _ := client.SearchRestaurants(ctx, "carbone")
    
    // Check availability
    slots, _ := client.CheckAvailability(ctx, venueID, "2025-10-20", 2)
    
    // Get booking details (required step!)
    details, _ := client.GetBookingDetails(ctx, slots[0].Config.Token, date, partySize)
    
    // Book reservation
    booking, _ := client.BookReservation(ctx, details.BookToken.Value, paymentID)
}

To use this library in your project:

go get github.com/kvetrivel/resy-bot

Project Structure

resy-bot/
├── README.md                        # You are here
├── go.mod                           # Go module definition
├── go.sum                           # Dependency checksums
├── credentials.yaml                 # Root credentials (optional)
├── credentials.example.yaml         # Root template
│
├── pkg/resybot/                     # Core library (import this)
│   ├── client.go                    # HTTP client and auth
│   ├── credentials.go               # YAML credential loader
│   ├── search.go                    # Restaurant search
│   ├── availability.go              # Availability checking
│   ├── booking.go                   # Reservation booking
│   ├── user.go                      # User profile operations
│   └── types.go                     # Data structures
│
├── cmd/                             # Command-line applications
│   └── sniper/
│       └── main.go                  # Sniper bot executable
│
├── examples/                        # Example programs
│   ├── credentials.yaml             # Example credentials (gitignored)
│   ├── credentials.example.yaml    # Template for examples
│   ├── api_explorer.go              # API exploration demo
│   ├── book_from_url.go             # Book from Resy URL
│   └── book_zensushi_safe.go        # Safe booking with prompts
│
└── docs/                            # Documentation
    ├── API_DOCUMENTATION.md         # Complete API reference
    └── ARCHITECTURE.md              # System design and patterns

Components

Examples (examples/)

Ready-to-run demonstration programs:

  • api_explorer.go - Interactive API explorer demonstrating all endpoints
  • book_from_url.go - Universal booking from any Resy URL
  • book_zensushi_safe.go - Safe booking with step-by-step confirmations

Commands (cmd/)

Standalone executable applications:

  • sniper - High-speed reservation sniper bot with 100ms polling
    • Single-venue mode: Target specific restaurant/time
    • Multi-venue mode: First-available across multiple restaurants
    • Automatic payment method handling

Library (pkg/resybot/)

Core Go package for building your own tools:

  • Full Resy API coverage
  • Type-safe interfaces
  • Context-aware operations
  • Concurrent-safe client

API Endpoints

All endpoints documented in docs/API_DOCUMENTATION.md:

  • POST /3/venuesearch/search - Search restaurants
  • GET /4/find - Check availability
  • POST /3/details - Get booking details
  • POST /3/book - Book reservation
  • GET /4/user - Get user data
  • GET /3/venue - Get venue details
  • GET /2/venue/calendar - Get venue calendar

Architecture

See docs/ARCHITECTURE.md for detailed design patterns, token flow, and best practices.

Key Concepts

Two-Token System:

  1. Config Token - From availability check
  2. Book Token - From booking details (real token)

Always call GetBookingDetails() before BookReservation():

// ❌ WRONG - will fail
booking, _ := client.BookReservation(ctx, slot.Config.Token, nil)

// ✅ CORRECT
details, _ := client.GetBookingDetails(ctx, slot.Config.Token, date, partySize)
booking, _ := client.BookReservation(ctx, details.BookToken.Value, paymentID)

Best Practices

Rate Limiting

  • Sniper mode: 100ms intervals (safe)
  • Manual checks: 1-5 second intervals
  • Production: Add exponential backoff

Payment Methods

  • Store payment ID from GetBookingDetails()
  • Some restaurants require payment, others don't
  • Use nil if no payment required

Token Expiration

  • Auth tokens expire after ~45 days
  • Refresh when you see 401 errors
  • Store securely, never commit

Error Handling

booking, err := client.BookReservation(ctx, bookToken, paymentID)
if err != nil {
    // Check if token expired
    // Check if slot no longer available
    // Check if payment required
}

Security

Never commit credentials:

  • credentials.yaml files are in .gitignore
  • ✅ All examples load from local YAML files
  • ✅ Documentation uses placeholder values
  • ✅ Template files provided (.example.yaml)

Before pushing to GitHub:

# Verify credentials are ignored
git status

# Should NOT see:
# - credentials.yaml
# - examples/credentials.yaml
#
# Should see:
# - credentials.example.yaml
# - examples/credentials.example.yaml

Troubleshooting

"Booking failed: invalid book token"

  • You used config token instead of book token
  • Call GetBookingDetails() first

"401 Unauthorized"

  • Auth token expired (refresh it)
  • Token format incorrect

"No availability found"

  • Restaurant fully booked
  • Try different date or party size
  • Use sniper mode for cancellations

"Payment method required"

  • Add credit card in Resy app/website
  • Pass payment ID to BookReservation()

Contributing

This is a personal project, but feel free to fork and customize for your needs.

Disclaimer

This tool is for educational and personal use only. Please use responsibly and respect Resy's terms of service. Don't abuse the API or harm the platform.

  • Use reasonable polling intervals
  • Don't run multiple snipers simultaneously for same restaurant
  • Be a good citizen of the platform

License

MIT License - Use at your own risk

Support


Built with ❤️ for food lovers who hate refreshing at midnight

About

High-performance Go API for Resy bookings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages