API Setup Guide
API Setup Guide
Geocodio API Configuration
This site can optionally use the Geocodio API to provide more detailed representative lookup functionality.
Setup Instructions
- Get a free API key:
- Visit https://geocod.io
- Sign up for a free account
- You get 2,500 free lookups per day
- Add your API key:
- Open
_config.yml - Find the line:
geocodio_api_key: "YOUR_GEOCODIO_API_KEY_HERE" - Replace
YOUR_GEOCODIO_API_KEY_HEREwith your actual API key - Keep the quotes around the key
- Open
- Restart Jekyll:
- Stop your Jekyll server (Ctrl+C)
- Run
bundle exec jekyll serveagain - The API will now be active
What the API Provides
With API Key:
- Exact congressional district numbers
- Representative and senator names
- Direct phone numbers and websites
- Precise geographic data
Without API Key (fallback):
- State identification from ZIP code
- Links to official government lookup tools
- Still fully functional for users
Security Note
Your API key will be visible in the client-side JavaScript. For production use, consider:
- Using environment variables in your CI/CD
- Setting up a backend proxy for the API calls
- The free tier should be sufficient for most use cases
Troubleshooting
If the API isnβt working:
- Check that your API key is correctly set in
_config.yml - Ensure youβve restarted Jekyll after making changes
- Check the browser console for any error messages
- The site will automatically fall back to the local ZIP lookup if the API fails