Skip to main content

Authentication

The Harvest API uses API key authentication for all requests. You’ll need to include your API key in the API-Key header for every request.

Getting Your API Key

  1. Log in to your Harvest dashboard
  2. Navigate to SettingsAPI Keys
  3. Click Generate New API Key
  4. Copy and securely store your API key
Keep your API key secure and never expose it in client-side code or public repositories.

Using Your API Key

Include your API key in the API-Key header for all requests:
curl -X GET \
  "https://www.goharvest.ai/api/v1/developer/fetch-latest-run" \
  -H "API-Key: your-api-key-here" \
  -H "Content-Type: application/json"

Environment Variables

We recommend storing your API key as an environment variable:
HARVEST_API_KEY=your-api-key-here

API Key Scopes

Your API key provides access to:
  • Data Collection: Launch and manage scraping jobs
  • Results Access: Stream and fetch collected data
  • Job Management: View and control your scrape jobs

Security Best Practices

  • Store API keys in environment variables or secure vaults
  • Never commit API keys to version control
  • Use different keys for development and production
  • Rotate API keys regularly
  • Monitor API key usage in your dashboard
  • Revoke unused or compromised keys immediately
  • Always use HTTPS for API requests
  • Implement proper error handling to avoid key exposure
  • Consider IP allowlisting for sensitive applications

Authentication Errors

If authentication fails, you’ll receive a 401 Unauthorized response:
{
  "detail": "Invalid API key",
  "status_code": 401
}
Common authentication issues:
  • Missing API key: Include the API-Key header
  • Invalid key: Check your key in the dashboard
  • Expired key: Generate a new API key
  • Wrong endpoint: Ensure you’re using the correct base URL

Rate Limiting

API keys are subject to rate limits:
  • 100 requests per minute for standard endpoints
  • 10 concurrent streams for streaming endpoints
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

Next Steps

I