Authentication overview

FraudLabs Pro requires authentication for all API requests to ensure that only authorized applications can submit data for fraud detection and retrieve results. The system primarily uses a unique API Key assigned to each merchant account. This key serves as the primary credential for authenticating requests, allowing the FraudLabs Pro API to identify the sender and apply the correct account permissions and rate limits. The architecture is designed to integrate into various e-commerce platforms and custom applications, facilitating automated fraud screening during transaction processing.

Integrating with the FraudLabs Pro API involves fetching the API Key from the merchant dashboard and including it in your API requests. This method is common for RESTful APIs where client identification is crucial for resource access control and monitoring. Consistent authentication is vital for maintaining the integrity of fraud detection processes and protecting sensitive transaction data as it moves between your system and FraudLabs Pro.

Supported authentication methods

FraudLabs Pro’s API authentication primarily uses a single method:

  • API Key (Query Parameter): The API Key is passed directly within the URL as a query parameter in each API request.

This approach simplifies integration, especially for web applications and server-side scripts that need to quickly make requests without complex cryptographic handshake procedures. Below is a table detailing the authentication method.

Method When to Use Security Level
API Key (Query Parameter) Best for server-to-server communication where the key can be securely managed and kept out of client-side code. Suitable for integrating fraud checks into backend payment gateways or order processing systems. Moderate (relies on HTTPS for in-transit protection; key storage is critical)

While API key authentication is straightforward, its security heavily depends on how the key is managed and transmitted. FraudLabs Pro's documentation emphasizes using HTTPS for all API calls to encrypt the key during transit, mitigating the risk of interception. This aligns with general recommendations for securing API communications, as detailed in web security guides like the Mozilla Developer Network's guide on Authorization headers.

Getting your credentials

To authenticate with the FraudLabs Pro API, you need to obtain your unique API Key. This key is provisioned upon account creation and is accessible through your merchant portal.

Steps to retrieve your API Key:

  1. Log In: Navigate to the FraudLabs Pro website and log in to your merchant account.
  2. Access Merchant Area: Once logged in, locate the 'Merchant Area' or 'Dashboard' section.
  3. Find API Key: Look for a section typically labeled 'API Key' or 'Developer Settings'. The API Key will be displayed there. It is a unique alphanumeric string.
  4. Copy Key: Copy the displayed API Key securely.

FraudLabs Pro provides different types of API keys for specific purposes, such as a Transaction API Key for general fraud screening requests and an Order Feedback API Key for submitting feedback on processed orders. Ensure you use the correct key for the intended API endpoint. The FraudLabs Pro API reference details the specific endpoints and required key types.

Authenticated request example

Below is an example of an authenticated request using the FraudLabs Pro API, demonstrating how the API Key is included as a query parameter. This example uses a hypothetical API endpoint for checking an order, common in fraud detection workflows.

Example using cURL:

curl -X GET \
  "https://api.fraudlabspro.com/v2/order/screen?key=YOUR_API_KEY&format=json&ip=192.168.1.1&amount=100.00&currency=USD&[email protected]" \
  -H "Content-Type: application/json"

In this cURL example:

  • YOUR_API_KEY should be replaced with the actual API Key retrieved from your FraudLabs Pro merchant area.
  • ip, amount, currency, and email are examples of data fields sent for fraud screening.
  • format=json specifies the desired response format.

Example using Python:

import requests

API_KEY = "YOUR_API_KEY"
API_ENDPOINT = "https://api.fraudlabspro.com/v2/order/screen"

params = {
    "key": API_KEY,
    "format": "json",
    "ip": "192.168.1.1",
    "amount": "100.00",
    "currency": "USD",
    "email": "[email protected]"
}

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

This Python snippet uses the requests library to construct a GET request, passing the API Key and other parameters as a dictionary. The response from the API would contain fraud assessment data.

Similar examples and SDKs for PHP, Java, Ruby, and Node.js are available in the FraudLabs Pro developer documentation, simplifying integration for various technical stacks.

Security best practices

Proper management of authentication credentials is paramount for securing your integration with FraudLabs Pro and preventing unauthorized access to your fraud detection services. Adhering to these security best practices helps protect your API Key and the integrity of your fraud prevention efforts.

1. Secure API Key Storage:

  • Environment Variables: Store API Keys as environment variables on your server infrastructure. This prevents the key from being hardcoded into your application's source code, which could be exposed in version control systems. Services like AWS Elastic Beanstalk or Kubernetes support environment variable injection, as outlined in AWS documentation on environment properties.
  • Secrets Management Services: For advanced deployments, consider using dedicated secrets management services like AWS Secrets Manager, Google Cloud Secret Manager, or Azure Key Vault. These services provide centralized, secure storage and controlled access to sensitive credentials.
  • Configuration Files: If environment variables or secret managers are not feasible, store keys in configuration files that are excluded from version control (e.g., via .gitignore) and have restricted file system permissions.

2. Transmit Keys Securely:

  • Always Use HTTPS: Ensure all API requests to FraudLabs Pro are made over HTTPS. This encrypts the communication channel, protecting your API Key and request data from eavesdropping during transit. FraudLabs Pro APIs typically enforce HTTPS by default.

3. Principle of Least Privilege:

  • Dedicated Keys: If FraudLabs Pro offers different types of API keys or allows permission scoping, use keys with only the necessary permissions for the task at hand. For instance, a key for submitting order feedback should not have permissions to modify account settings.

4. Regular Key Rotation:

  • Periodic Rotation: Periodically rotate your API Keys. This minimizes the window of exposure if a key is compromised. The frequency of rotation depends on your organization's security policies and risk assessment.
  • Immediate Rotation on Compromise: If you suspect an API Key has been compromised, revoke it immediately through your FraudLabs Pro merchant dashboard and generate a new one.

5. Monitor API Usage:

  • Review Logs: Regularly review API access logs provided by FraudLabs Pro (if available) or your own server logs. Look for unusual access patterns, excessive requests, or requests from unexpected IP addresses, which could indicate unauthorized use of your API Key.

6. Client-Side Code Protection:

  • Avoid Client-Side Exposure: Never embed your FraudLabs Pro API Key directly into client-side JavaScript, mobile applications, or any code that runs directly in a user's browser or device. If client-side interaction is required, route requests through a secure backend proxy that handles authentication.

By implementing these practices, developers can significantly enhance the security posture of their integrations with the FraudLabs Pro API, safeguarding both their operations and customer data.