Deepware Developer page is explaining how to use Deepware API and SDK to scan deepfake videos.
Overview
Deepware API is designed as RESTful.
You can quickly access API endpoints to scan videos and YouTube URLs.
How It Works ?
When you send a “scan” request to Deepware API, your scan request will be added to a queue for processing. After that the video you uploaded will be scanned with Deepware AI model.
The whole process is working asynchronously. After your “scan” request, you need to handle “report-id” that you received in the response and you need to send it to “report” endpoint to get result. If “report” endpoint returns “complete” key as “true”, it means your process has been completed, but it does not, you need to send another request to “report” endpoint with same “report-id” until you get “complete” as “true”.
Base URL
Authentication
Every endpoint is required a “X-Deepware-Authentication” token in HTTP headers for authentication. You must submit to get a token before using all the services.
To submit for a key please click the link below.
Rate Limiting
Your test API key can perform limited “scan” requests. You need to contact us to extend your keys limitation.
API References
Deepware Video Scanner API 1.0.0
[ Base URL: api.deepware.ai/api/v1 ] /swagger.json
Deepware is a deepfake detection api. You can find out more about Deepware at https://deepware.ai. For this sample, you can use the api key X-Deepware-Authentication to test the api.
Scanner
/video/scan Start a scan process bu video file
Parameters
Name
video
file
(formData)
Description
The video file to upload
Responses
Code
200
204
400
Responses content type : application/json
Description
OK
Example Value
{
"report-id": "string",
"video-id": "string",
"message": "string"
}
Model
{
report-id string
video-id string
message string
}
Request rate limit exceed
Invalid format
Example Value
{
"Message": "string"
}
Model
{
Message string
}
/url/scan
Start a scan process by URL (Youtube, Facebook or Twitter)
Parameters
Name
videourl
string
(formData)
Description
Write a valid video URL
Responses
Code
200
204
400
Response content type : application/json
Description
OK
Example Value
{
"report-id": "string",
"video-id": "string",
"message": "string"
}
Model
YtScan {
report-id string
video-id string
message string
}
Request rate limit exceeded
Invalid format
Example Value
{
"Message": "string"
}
Model
Message {
Message string
}
Models
Scan
{
report-id string
video-id string
message string
}
YtScan
{
report-id string
video-id string
message string
}
Report
{
report-id string
video-id string
type string
size integer($int64)
names [string]
total integer($int32)
positive integer($int32)
complete boolean
results {
< * >: Result
{
detected boolean
score integer($int32)
}
}
}
Result
{
detected boolean
score integer($int32)
}
Message
{
Message string
}
Code Samples
Curl
curl -X POST -H "X-Deepware-Authentication: [[apiKey]]"\ -H "Accept: application/json"\ -H "Content-Type: multipart/form-data"\ "https://api.deepware.ai/api/v1/url/scan"
Java
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ScannerApi;
import java.io.File;
import java.util.*;
public class ScannerApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
ScannerApi apiInstance = new ScannerApi();
String video/URL = video/URL_example; // String |
try {
YtScan result = apiInstance.urlscan(video/URL);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ScannerApi#urlscan");
e.printStackTrace();
}
}
}
Android
import io.swagger.client.api.ScannerApi;
public class ScannerApiExample {
public static void main(String[] args) {
ScannerApi apiInstance = new ScannerApi();
String video/URL = video/URL_example; // String |
try {
YtScan result = apiInstance.urlscan(video/URL);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ScannerApi#urlscan");
e.printStackTrace();
}
}
}
Obj-C
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-Deepware-Authentication"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-Deepware-Authentication"];
String *video/URL = video/URL_example; // (optional)
ScannerApi *apiInstance = [[ScannerApi alloc] init];
// Start a scan process by Youtube URL
[apiInstance urlscanWith:video/URL
completionHandler: ^(YtScan output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
Javascript
var DeepwareVideoScannerApi = require('deepware_video_scanner_api');
var defaultClient = DeepwareVideoScannerApi.ApiClient.instance;
// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['X-Deepware-Authentication'] = "Token"
var api = new DeepwareVideoScannerApi.ScannerApi()
var opts = {
'video/URL': video/URL_example // {{String}}
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.urlscan(opts, callback);
C#
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class urlscanExample
{
public void main()
{
// Configure API key authorization: api_key
Configuration.Default.ApiKey.Add("X-Deepware-Authentication", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("X-Deepware-Authentication", "Bearer");
var apiInstance = new ScannerApi();
var video/URL = video/URL_example; // String | (optional)
try
{
// Start a scan process by Youtube URL
YtScan result = apiInstance.urlscan(video/URL);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ScannerApi.urlscan: " + e.Message );
}
}
}
}
Php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
SwaggerClientConfiguration::getDefaultConfiguration()->setApiKey('X-Deepware-Authentication', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// SwaggerClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Deepware-Authentication', 'Bearer');
$api_instance = new SwaggerClientApiScannerApi();
$video/URL = video/URL_example; // String |
try {
$result = $api_instance->urlscan($video/URL);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ScannerApi->urlscan: ', $e->getMessage(), PHP_EOL;
}
?>
Perl
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ScannerApi;
# Configure API key authorization: api_key
$WWW::SwaggerClient::Configuration::api_key->{'X-Deepware-Authentication'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'X-Deepware-Authentication'} = "Bearer";
my $api_instance = WWW::SwaggerClient::ScannerApi->new();
my $video/URL = video/URL_example; # String |
eval {
my $result = $api_instance->urlscan(video/URL => $video/URL);
print Dumper($result);
};
if ($@) {
warn "Exception when calling ScannerApi->urlscan: $@
";
}
Python
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
swagger_client.configuration.api_key['X-Deepware-Authentication'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['X-Deepware-Authentication'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.ScannerApi()
video/URL = video/URL_example # String | (optional)
try:
# Start a scan process by Youtube URL
api_response = api_instance.urlscan(video/URL=video/URL)
pprint(api_response)
except ApiException as e:
print("Exception when calling ScannerApi->urlscan: %s" % e)