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 |
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: support@realitydefender.com
- 📖 Documentation: API Docs
- 🐛 Issues: GitHub Issues