Overview
toni integrates with the Yelp Fusion API to provide restaurant autocomplete, making it faster to log visits with accurate restaurant information. The integration is optional and toni works fully offline without it.Yelp integration is completely optional. You can use toni without an API key and manually enter restaurant information.
Getting a Yelp API Key
Visit Yelp Developers
Create an app
Sign in with your Yelp account and create a new app. You can use any name and description.
Configuration Methods
Method 1: Onboarding Flow (Recommended)
When you first run toni, it will guide you through an interactive onboarding flow defined incmd/onboarding.go:433:
- Ask if you want to enable Yelp autocomplete
- If enabled, prompt you to paste your API key
- Securely save the key to
~/.toni/yelp_api_keywith0600permissions - Create
~/.toni/onboarding.jsonto track completion
You can skip onboarding by pressing
Esc or choosing to disable Yelp. You can always re-enable it later by editing the configuration files.Method 2: Command-Line Flag
Provide the API key directly when launching toni:cmd/root.go:30.
Method 3: Environment Variable
Set theYELP_API_KEY environment variable:
cmd/root.go:39.
Method 4: .env File
toni automatically loads.env and .env.local files from the current directory:
loadDotEnv function in cmd/root.go:88.
Manual Configuration
You can manually configure Yelp integration by editing files in~/.toni/:
Enable/Disable Yelp
Edit~/.toni/onboarding.json:
yelp_enabled to false to disable Yelp autocomplete.
Store API Key
Create or edit~/.toni/yelp_api_key:
How Autocomplete Works
When Yelp is enabled, toni uses the Yelp Fusion Business Search API for autocomplete:- API endpoint:
https://api.yelp.com/v3/businesses/search(frominternal/search/yelp.go:12) - Search behavior: Filters by
categories=restaurants,foodand limits results to 8 matches - Default location: Uses “New York, NY” if no location is specified
- Sort order: Results sorted by
best_match - Timeout: 5 second request timeout
Data Retrieved
Frominternal/search/yelp.go:29, autocomplete suggestions include:
- Restaurant name
- Address (street, city)
- Neighborhood (stored as state)
- Cuisine (from first category)
- Price range (
$,$$,$$$,$$$$) - Latitude/longitude coordinates
- Yelp business ID (stored as
place_id)
Offline Mode
Yelp integration gracefully degrades when:- No API key is configured
- Network is unavailable
- API request fails
- Autocomplete is disabled
- You can still manually enter all restaurant information
- All other toni features work normally
All restaurant data is stored locally in SQLite. Yelp is only used for initial autocomplete - your data never depends on the Yelp API.
Priority Order
The API key is loaded with the following priority (fromcmd/root.go:38):
--yelp-keycommand-line flagYELP_API_KEYenvironment variable.envor.env.localfile~/.toni/yelp_api_keysecure file
Troubleshooting
Autocomplete Not Working
Verify your configuration:Re-running Onboarding
To re-run the onboarding flow:API Rate Limits
Yelp Fusion API has rate limits. If you hit limits:- Autocomplete will fail gracefully
- You can continue entering data manually
- Wait for the rate limit window to reset
For the most up-to-date Yelp API documentation, visit the Yelp Fusion API docs.