Skip to main content

Getting Started with Java

Safe API Key Storage

In a production setup, do not store API Keys in the host's environment variables or in the source code.

Overview

The Opportify Insights API provides access to a powerful and up-to-date platform. With advanced data warehousing, real-time validation, enrichment, and risk scoring capabilities, this API is designed to empower your business to make informed, data-driven decisions and effectively assess potential risks.

Base URLs

ProductBase URL
Email & IP Insightshttps://api.opportify.ai/insights/v1
Fraud Protectionhttps://api.opportify.ai/intel/v1

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

Add this dependency to your project's POM:

<dependency>
<groupId>ai.opportify</groupId>
<artifactId>opportify-sdk-java</artifactId>
<version>0.6.1</version>
<scope>compile</scope>
</dependency>

Install Using Maven as Package Manager

To install the SDK to your local Maven repository, execute:

mvn clean install

Getting Started

After installing the library, create a client instance and interface with it:

// Import classes:
import ai.opportify.client.ApiClient;
import ai.opportify.client.ApiException;
import ai.opportify.client.Configuration;
import ai.opportify.client.auth.*;
import ai.opportify.client.model.*;
import ai.opportify.client.api.EmailInsightsApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.opportify.ai/insights/v1");

// Configure API key authorization: opportifyToken
ApiKeyAuth opportifyToken = (ApiKeyAuth) defaultClient.getAuthentication("opportifyToken");
opportifyToken.setApiKey("YOUR API KEY");

EmailInsightsApi apiInstance = new EmailInsightsApi(defaultClient);
AnalyzeEmailRequest analyzeEmailRequest = new AnalyzeEmailRequest();
analyzeEmailRequest.setEmail("email_to_validate@domain.com");
analyzeEmailRequest.setEnableAutoCorrection(true);
analyzeEmailRequest.setEnableAi(true);
try {
AnalyzeEmail200Response result = apiInstance.analyzeEmail(analyzeEmailRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EmailInsightsApi#analyzeEmail");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

API Endpoints (Email & IP Insights)

All URIs are relative to https://api.opportify.ai/insights/v1

ClassMethodHTTP RequestDescription
EmailInsightsApianalyzeEmailPOST /email/analyzeAnalyze Email
EmailInsightsApibatchAnalyzeEmailsPOST /email/batchBatch Analyze Emails
EmailInsightsApicreateEmailBatchExportPOST /email/batch/{jobId}/exportsCreate Email Batch Export
EmailInsightsApigetEmailBatchExportStatusGET /email/batch/{jobId}/exports/{exportId}Get Email Batch Export Status
EmailInsightsApigetEmailBatchStatusGET /email/batch/{jobId}Get Email Batch Status
IpInsightsApianalyzeIpPOST /ip/analyzeAnalyze IP
IpInsightsApibatchAnalyzeIpsPOST /ip/batchBatch Analyze IPs
IpInsightsApicreateIpBatchExportPOST /ip/batch/{jobId}/exportsCreate IP Batch Export
IpInsightsApigetIpBatchExportStatusGET /ip/batch/{jobId}/exports/{exportId}Get IP Batch Export Status
IpInsightsApigetIpBatchStatusGET /ip/batch/{jobId}Get IP Batch Status

Authentication

  • Type: API key
  • API key parameter name: x-opportify-token
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.


GitHub Repository

View the source code, report issues, or contribute on GitHub:

opportify/opportify-sdk-java →