A Java SDK for the Reality Defender API to detect deepfakes and manipulated media.
- π Async & Sync APIs - Choose between synchronous and asynchronous operations
- π‘οΈ Type Safety - Full type safety with comprehensive model classes
- π Built-in Polling - Automatic result polling with configurable intervals
- π Retry Logic - Robust error handling and retry mechanisms
- π Comprehensive Logging - SLF4J integration for flexible logging
- Java 11 or higher
- Maven 3.6+ or Gradle 6+
<dependency>
<groupId>ai.realitydefender</groupId>
<artifactId>realitydefender-sdk</artifactId>
<version>[0.1.0,0.2)</version>
</dependency>or for Android projects or any other project where there may be dependency issues with the bundled libraries in the realitydefender-sdk artifact:
<dependency>
<groupId>ai.realitydefender</groupId>
<artifactId>realitydefender-sdk-minimal</artifactId>
<version>[0.1.0,0.2)</version>
</dependency>implementation 'ai.realitydefender:realitydefender-sdk:[0.1.0,0.2.0)'| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
String | Required | Your Reality Defender API key |
baseUrl |
String | https://api.realitydefender.com |
API base URL |
timeout |
Duration | 30 seconds | Request timeout |
import ai.realitydefender.models.UserFeedbackRequest;
import ai.realitydefender.models.UserFeedbackResponse;
UserFeedbackResponse feedback =
client.createUserFeedback(
new UserFeedbackRequest(
"your-request-id", "REAL", "CONFIRMATION", "Optional note"));Returns a UserFeedbackResponse. Each getter returns String (or null if that field was omitted in the JSON body):
| Accessor | Description |
|---|---|
getId() |
Created feedback record id |
getUserId() |
Authenticated user id |
getRequestId() |
Media / detection request id |
getInstitutionId() |
Organization id |
getCategory() |
Stored feedbackCategory |
getLabel() |
REAL, SYNTHETIC, MANIPULATED, or UNKNOWN |
getCreatedAt() |
Serialized timestamp when present |
getMediaViewUrl() |
Link to result in the web app |
getMediaSource() |
e.g. file upload or API source label |
getText() |
Comment text if the request included a comment |
getUserName() |
Display name when present |
getUserEmail() |
Email when present |
getOrgName() |
Organization name when present |
getMediaType() |
e.g. VIDEO, IMAGE when present |
The SDK throws RealityDefenderException for all API-related errors:
try {
DetectionResult result = client.detectFile(file);
} catch (RealityDefenderException e) {
System.err.println("Error: " + e.getMessage());
System.err.println("Code: " + e.getCode());
System.err.println("Status Code: " + e.getStatusCode());
}Common error codes:
UNAUTHORIZED- Invalid API keyINVALID_FILE- Unsupported file formatUPLOAD_FAILED- File upload failedTIMEOUT- Request timed outSERVER_ERROR- Internal server error
There is a size limit for each of the supported file types.
| File Type | Extensions | Size Limit (bytes) | Size Limit (MB) |
|---|---|---|---|
| Video | .mp4, .mov | 262,144,000 | 250 MB |
| Image | .jpg, .png, .jpeg, .gif, .webp | 52,428,800 | 50 MB |
| Audio | .flac, .wav, .mp3, .m4a, .aac, .alac, .ogg | 20,971,520 | 20 MB |
| Text | .txt | 5,242,880 | 5 MB |
The Reality Defender API supports analysis of media from the following social media platforms:
- YouTube
- TikTok
mvn clean compilemvn testmvn verifymvn jacoco:report
open target/site/jacoco/index.htmlmvn spotless:applySet your API key:
export REALITY_DEFENDER_API_KEY="your_api_key_here"Run specific examples:
# Simple file detection example
mvn exec:java@simple-example
# Get results example (pagination, filtering, async)
mvn exec:java@get-results-example
# Social media detection example
mvn exec:java@social-media-example- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass and coverage is maintained
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- π§ Email: [email protected]
- π Documentation: API Docs
- π Issues: GitHub Issues