TruthScan SDK Docs
SDK Documentation
ISO 27001SOC 2 CertifiedGDPR Compliant

AI Image Detection API — Client SDKs

Official client libraries for TruthScan AI Image Detection. Detect whether images are AI-generated, real, digitally edited, or AI-edited in a single method call.

Python SDK

Official Python client for TruthScan AI Image Detection. Detect whether images are AI-generated, real, digitally edited, or AI-edited in a single method call.

Requirements

RequirementDetails
Python3.9 or later
Dependencypip install truthscan-image-detector-client
API KeySet environment variable TRUTHSCAN_API_KEY to your key

Download

Packagetruthscan-image-detector-client
Registryhttps://pypi.org/project/truthscan-image-detector-client/

Install the latest version — check the registry link above for the current release number.

Install

pip install truthscan-image-detector-client

Run Image Detection

Call client.detect() with an image path. The method handles presign, upload, detection, and polling automatically — it blocks until the result is ready.

import os
from truthscan.image_detection import ImageDetectionClient

# Load API key from environment
api_key = os.environ.get("TRUTHSCAN_API_KEY", "your_api_key_here")

client = ImageDetectionClient(api_key=api_key)

# Run full detection workflow
result = client.detect("path/to/image.jpg")
print(f"Status : {result['status']}")
print(f"Score : {result.get('result', 'N/A')}")
print(f"Final : {(result.get('result_details') or {}).get('final_result', '')}")

JavaScript / TypeScript SDK

Official TypeScript/JavaScript client for TruthScan AI Image Detection. Works in any Node.js project and ships with full TypeScript type declarations.

Requirements

RequirementDetails
Node.js18 or later
Package Managernpm, yarn, or pnpm
API KeySet environment variable TRUTHSCAN_API_KEY to your key

Download

Package@truthscan/image-detection
Registryhttps://www.npmjs.com/package/@truthscan/image-detection

Install the latest version — check the registry link above for the current release number.

Install

npm install @truthscan/image-detection

Run Image Detection

Call client.detect() with an image path. The method handles presign, upload, detect, and poll — it resolves the Promise when the result is ready.

import { ImageDetectionClient } from '@truthscan/image-detection';

// Load API key from environment
const apiKey = process.env.TRUTHSCAN_API_KEY ?? 'your_api_key_here';

const client = new ImageDetectionClient(apiKey);

// Run full detection workflow
const result = await client.detect('/path/to/image.jpg');
console.log('Status :', result.status);
console.log('Score :', result.result ?? 'N/A');
console.log('Final :', result.result_details?.final_result ?? '');

PHP SDK

Official PHP client for TruthScan AI Image Detection. Compatible with PHP 7.4+ and installable via Composer.

Requirements

RequirementDetails
PHP7.4 or later
Extensioncurl (must be enabled)
API KeySet environment variable TRUTHSCAN_API_KEY to your key

Download

Packagetruthscan/image-detector-client
Registryhttps://packagist.org/packages/truthscan/image-detector-client

Install the latest version — check the registry link above for the current release number.

Install

composer require truthscan/image-detector-client

Run Image Detection

Call $client->detect() with an image path. The method handles presign, upload, detect, and polling — it returns when the result is ready.

<?php
require_once __DIR__ . '/vendor/autoload.php';

use Truthscan\ImageDetection\ImageDetectionClient;

// Load API key from environment
$apiKey = getenv('TRUTHSCAN_API_KEY') ?: 'your_api_key_here';

$client = new ImageDetectionClient($apiKey);

// Run full detection workflow
$result = $client->detect('/path/to/image.jpg');
echo "Status : {$result->status}\n";
echo 'Score : ' . ($result->result ?? 'N/A') . "\n";
echo 'Final : ' . ($result->result_details->final_result ?? '') . "\n";

.NET SDK

Official .NET client for TruthScan AI Image Detection. Available on NuGet and compatible with modern .NET projects.

Requirements

RequirementDetails
.NETSee NuGet page for supported target frameworks
Tool.NET CLI or Visual Studio NuGet Package Manager
API KeySet environment variable TRUTHSCAN_API_KEY to your key

Download

PackageTruthscan.ImageDetection
Registryhttps://www.nuget.org/packages/Truthscan.ImageDetection/

Install the latest version — check the registry link above for the current release number.

Install

dotnet add package Truthscan.ImageDetection

Or add to your .csproj project file

<PackageReference Include="Truthscan.ImageDetection" Version="LATEST_VERSION" />

Run Image Detection

Call await client.Detect() with an image path. The method handles presign, upload, detect, and polling — it completes when the result is ready.

using Truthscan.ImageDetection;

// Load API key from environment
var apiKey = Environment.GetEnvironmentVariable("TRUTHSCAN_API_KEY")
    ?? "YOUR_API_KEY";

var client = new ImageDetectionClient(apiKey);

// Run full detection workflow
var result = await client.Detect("/path/to/image.jpg");
Console.WriteLine($"Status : {result.Status}");
Console.WriteLine($"Score : {result.Result}");
Console.WriteLine($"Final : {result.ResultDetails?.FinalResult}");

Java SDK

Official Java client for TruthScan AI Image Detection. Available on Maven Central and compatible with Java 11+. Use detectImage() for a single call that runs the full workflow.

Requirements

RequirementDetails
Java11 or later
Build ToolMaven or Gradle
API KeySet environment variable TRUTHSCAN_API_KEY to your key

Download

Packagecom.truthscan:ai-image-detector-client
Registryhttps://central.sonatype.com/artifact/com.truthscan/ai-image-detector-client

Install the latest version — check the registry link above for the current release number.

Install

Maven (pom.xml)

<dependency>
  <groupId>com.truthscan</groupId>
  <artifactId>ai-image-detector-client</artifactId>
  <version>LATEST_VERSION</version>
</dependency>

Gradle (build.gradle)

implementation 'com.truthscan:ai-image-detector-client:LATEST_VERSION'

Run Image Detection

Call client.detectImage() with a File reference. The method handles presign, upload, detect, and polling — it returns when the result is ready. Always call client.close() when finished.

import com.truthscan.imageDetection.*;
import java.io.File;

// Load API key from environment
String apiKey = System.getenv("TRUTHSCAN_API_KEY");

ImageDetectionClient client = new ImageDetectionClient(apiKey);

// Run full detection workflow
DetectionResult result = client.detectImage(new File("photo.jpg"));
System.out.println("Result : " + result.getFinalResult());
System.out.println("Score : " + result.getResult());

// Always close the client when done
client.close();