Skip to main content

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

  1. Get a free API key:
    • Visit https://geocod.io
    • Sign up for a free account
    • You get 2,500 free lookups per day
  2. Add your API key:
    • Open _config.yml
    • Find the line: geocodio_api_key: "YOUR_GEOCODIO_API_KEY_HERE"
    • Replace YOUR_GEOCODIO_API_KEY_HERE with your actual API key
    • Keep the quotes around the key
  3. Restart Jekyll:
    • Stop your Jekyll server (Ctrl+C)
    • Run bundle exec jekyll serve again
    • 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:

  1. Check that your API key is correctly set in _config.yml
  2. Ensure you’ve restarted Jekyll after making changes
  3. Check the browser console for any error messages
  4. The site will automatically fall back to the local ZIP lookup if the API fails