Authentication overview

EmailRep provides a service for checking the reputation of email addresses, primarily used for fraud prevention and threat intelligence. Access to the EmailRep API requires authentication to ensure that requests are made by authorized users and applications. The core authentication mechanism for the EmailRep API involves the use of a unique API key, which acts as a secret token to verify the identity of the client making the request. This approach is common among RESTful APIs for its simplicity and effectiveness in controlling access and managing usage limits Google Cloud API key authentication guide. The API key is linked to your EmailRep account, and different subscription tiers may grant varying levels of access and request quotas based on the key used.

When an API key is used for authentication, it is typically included in the HTTP request header. This method provides a balance between ease of implementation and security, as the key is not exposed in the URL, reducing the risk of accidental logging or exposure. Proper management and protection of this API key are critical to maintaining the security of your integration and preventing unauthorized use of your EmailRep account balance and access rights.

Supported authentication methods

EmailRep exclusively supports API key authentication for its programmatic interface. This method involves generating a unique string from your account dashboard and including it with each API request. API keys are suitable for server-to-server communication or applications where the key can be securely stored and managed.

EmailRep API Authentication Methods
Method When to Use Security Level
API Key Server-side applications, backend services, script-based integrations, batch processing. Moderate (depends on key storage and transmission practices).

The API key functions as a bearer token. The client includes the key in the Authorization header of their HTTP requests, prefixed with Bearer. This standard practice for token-based authentication is widely adopted for RESTful services due to its stateless nature and relative ease of implementation OAuth 2.0 Bearer Token Usage specification.

Getting your credentials

To obtain your EmailRep API key, follow these steps:

  1. Create an Account: Navigate to the EmailRep homepage and sign up for an account. You can start with the free tier, which provides 100 requests per day.
  2. Access Dashboard: Once registered and logged in, locate your account dashboard. This is typically accessible via a link like 'My Account' or 'Dashboard' after successful login.
  3. Generate API Key: Within your dashboard, there should be a section specifically for API access or API keys. EmailRep automatically generates an API key for new accounts. If not, you may find an option to generate a new key there.
  4. Copy Your Key: Your API key will be displayed. It is a long alphanumeric string. Copy this key immediately and store it securely. EmailRep's documentation advises that you treat this key as a sensitive credential, similar to a password EmailRep API Quickstart Guide. Once generated, some platforms may not display the full key again for security reasons, requiring regeneration if lost.
  5. Understand Usage Limits: Be aware of the usage limits associated with your account tier. The free tier allows 100 requests per day. Upgrading to a paid plan will increase this limit, as detailed on the EmailRep pricing page. Your API key will automatically reflect the quota of your current subscription.

Authenticated request example

Once you have obtained your API key, you can include it in the Authorization header of your HTTP requests. Here's an example using cURL to query the reputation of an email address:

curl -X GET \
  'https://emailrep.io/[email protected]' \
  -H 'Key: YOUR_API_KEY_HERE'

Replace YOUR_API_KEY_HERE with your actual EmailRep API key and [email protected] with the email address you wish to query. The API key is passed in a custom header named Key (not Authorization as is common with Bearer tokens). This is a specific implementation detail for EmailRep's API.

Here's a Python example for making an authenticated request:

import requests

api_key = "YOUR_API_KEY_HERE"
email_address = "[email protected]"
url = f"https://emailrep.io/{email_address}"

headers = {
    "Key": api_key
}

try:
    response = requests.get(url, headers=headers)
    response.raise_for_status()  # Raise an HTTPError for bad responses (4xx or 5xx)
    data = response.json()
    print(data)
except requests.exceptions.HTTPError as err:
    print(f"HTTP error occurred: {err}")
except requests.exceptions.RequestException as err:
    print(f"An error occurred: {err}")

This Python snippet demonstrates how to construct the request using the requests library, including the API key in the Key header, and handle potential errors. The response will be a JSON object containing reputation data for the queried email address.

Security best practices

Securing your EmailRep API key is crucial to prevent unauthorized access to your account and API usage. Adhering to these best practices can help maintain the integrity of your integration:

  • Do Not Expose API Keys in Client-Side Code: Never embed your API key directly into client-side code (e.g., JavaScript in web browsers or mobile applications). This makes the key easily discoverable and exploitable. All API calls should originate from a secure backend server where the key can be protected.
  • Environment Variables: Store your API key as an environment variable on your server. This prevents the key from being hardcoded into your application's source code, separating credentials from code. For example, in Linux/Unix-like systems, you might use export EMAILREP_API_KEY="YOUR_API_KEY".
  • Secret Management Services: For complex or enterprise-level deployments, utilize dedicated secret management services like AWS Secrets Manager AWS Secrets Manager documentation, Google Secret Manager Google Cloud Secret Manager overview, or Azure Key Vault. These services provide secure storage, fine-grained access control, and auditing capabilities for API keys and other sensitive information.
  • Restrict Access to API Keys: Limit access to your API key to only those team members and systems that absolutely require it. Implement role-based access control (RBAC) where possible.
  • Secure Communication (HTTPS/TLS): Always transmit your API key over HTTPS (TLS/SSL) connections. This encrypts the data in transit, protecting the key from interception by malicious actors. EmailRep's API endpoints are served over HTTPS, so ensure your client-side implementation also enforces secure connections.
  • IP Whitelisting (if available): If EmailRep offers IP whitelisting capabilities (restricting API key usage to specific IP addresses), enable this feature. This adds an extra layer of security, ensuring that even if your key is compromised, it can only be used from trusted network locations. (Consult EmailRep documentation to confirm if this feature is supported).
  • Regular Key Rotation: Periodically rotate your API keys. This practice minimizes the window of exposure for a compromised key. If you suspect a key has been compromised, revoke it immediately through your EmailRep account dashboard and generate a new one.
  • Monitor API Usage: Regularly check your EmailRep account dashboard for unusual API usage patterns. Spikes in requests or activity from unexpected regions could indicate a compromised key.