import os, requests
# Set API key ENV variable or replace with your own API key
API_KEY = os.getenv("AIORNOT_API_KEY")
VIDEO_ENDPOINT = "https://api.aiornot.com/v2/video/sync"
with open("video.mp4", "rb") as video_file:
files = {"video": video_file}
resp = requests.post(
VIDEO_ENDPOINT,
headers={"Authorization": f"Bearer {API_KEY}"},
files=files,
# Uncomment below to use only, excluding, or external_id params.
# params={
# "only": ["ai_video", "ai_voice"],
# "excluding": ["ai_music"],
# "external_id": "my-tracking-id-123"
# },
# To enable deepfake detection (OFF by default), include it in the only param:
# params={
# "only": ["deepfake_video"]
# },
timeout=120
)
if resp.status_code != 200:
raise Exception(f"Failed to analyze video: {resp.status_code} {resp.text}")
print(resp.json())curl --request POST \
--url https://api.aiornot.com/v2/video/sync \
--header 'Authorization: Bearer $AIORNOT_API_KEY' \
--form 'video=@video.mp4' \
--max-time 120
const fs = require('fs');
const FormData = require('form-data');
const fetch = require('node-fetch');
const API_KEY = process.env.AIORNOT_API_KEY;
const VIDEO_ENDPOINT = 'https://api.aiornot.com/v2/video/sync';
const form = new FormData();
form.append('video', fs.createReadStream('video.mp4'));
fetch(VIDEO_ENDPOINT, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
...form.getHeaders()
},
body: form,
timeout: 120000
})
.then(response => {
if (!response.ok) {
throw new Error(`Failed to analyze video: ${response.status} ${response.statusText}`);
}
return response.json();
})
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$API_KEY = getenv('AIORNOT_API_KEY');
$VIDEO_ENDPOINT = 'https://api.aiornot.com/v2/video/sync';
$curl = curl_init();
$videoFile = new CURLFile('video.mp4', 'video/mp4', 'video');
curl_setopt_array($curl, [
CURLOPT_URL => $VIDEO_ENDPOINT,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'video' => $videoFile
],
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $API_KEY"
],
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} elseif ($httpCode !== 200) {
echo "Failed to analyze video: HTTP $httpCode - $response";
} else {
$data = json_decode($response, true);
print_r($data);
}
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
"time"
)
func main() {
APIKey := os.Getenv("AIORNOT_API_KEY")
videoEndpoint := "https://api.aiornot.com/v2/video/sync"
file, err := os.Open("video.mp4")
if err != nil {
panic(err)
}
defer file.Close()
var requestBody bytes.Buffer
writer := multipart.NewWriter(&requestBody)
part, err := writer.CreateFormFile("video", "video.mp4")
if err != nil {
panic(err)
}
_, err = io.Copy(part, file)
if err != nil {
panic(err)
}
err = writer.Close()
if err != nil {
panic(err)
}
client := &http.Client{
Timeout: 120 * time.Second,
}
req, err := http.NewRequest("POST", videoEndpoint, &requestBody)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+APIKey)
req.Header.Set("Content-Type", writer.FormDataContentType())
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
if resp.StatusCode != 200 {
fmt.Printf("Failed to analyze video: %d %s\n", resp.StatusCode, string(body))
return
}
fmt.Println(string(body))
}
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import okhttp3.*;
public class VideoAnalysis {
public static void main(String[] args) {
String apiKey = System.getenv("AIORNOT_API_KEY");
String videoEndpoint = "https://api.aiornot.com/v2/video/sync";
OkHttpClient client = new OkHttpClient.Builder()
.readTimeout(120, TimeUnit.SECONDS)
.build();
File videoFile = new File("video.mp4");
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("video", videoFile.getName(),
RequestBody.create(MediaType.parse("video/mp4"), videoFile))
.build();
Request request = new Request.Builder()
.url(videoEndpoint)
.header("Authorization", "Bearer " + apiKey)
.post(requestBody)
.build();
try {
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) {
System.err.println("Failed to analyze video: " + response.code() + " " + response.body().string());
} else {
System.out.println(response.body().string());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
require 'uri'
require 'net/http'
url = URI("https://api.aiornot.com/v2/video/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"report": {
"ai_video": {
"is_detected": true,
"confidence": 0.95
},
"ai_voice": {
"is_detected": true,
"confidence": 0.95
},
"ai_music": {
"is_detected": true,
"confidence": 0.95
},
"meta": {
"duration": 120,
"total_bytes": 362594,
"md5": "db36d923800f6ca6b7f87cff8a19d1d1",
"audio": "processed",
"video": "processed"
},
"deepfake_video": {
"is_detected": true,
"confidence": 0.936413076150301,
"no_faces_found": false
}
},
"external_id": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}Video
Analyze a video file to determine if it contains AI-generated content.
This endpoint analyzes both the video and audio components of the file, providing separate confidence scores for AI-generated video, voice, and music. It can also optionally detect deepfake video content when explicitly requested.
Caveats:
- This endpoint can take up to two minutes for longer video files or if our backend is spinning up additional processing nodes. Please set a 120 second timeout in your client.
- This endpoint is synchronous and will only analyze a portion of the content for longer duration videos. The response includes the duration tested. For videos longer than 30 seconds, we recommend breaking them into 30-second segments on the client side for complete analysis.
- Due to a limitation in our document provider, the playground only supports small files of up to 10MB. This limit does not apply when using the API directly.
import os, requests
# Set API key ENV variable or replace with your own API key
API_KEY = os.getenv("AIORNOT_API_KEY")
VIDEO_ENDPOINT = "https://api.aiornot.com/v2/video/sync"
with open("video.mp4", "rb") as video_file:
files = {"video": video_file}
resp = requests.post(
VIDEO_ENDPOINT,
headers={"Authorization": f"Bearer {API_KEY}"},
files=files,
# Uncomment below to use only, excluding, or external_id params.
# params={
# "only": ["ai_video", "ai_voice"],
# "excluding": ["ai_music"],
# "external_id": "my-tracking-id-123"
# },
# To enable deepfake detection (OFF by default), include it in the only param:
# params={
# "only": ["deepfake_video"]
# },
timeout=120
)
if resp.status_code != 200:
raise Exception(f"Failed to analyze video: {resp.status_code} {resp.text}")
print(resp.json())curl --request POST \
--url https://api.aiornot.com/v2/video/sync \
--header 'Authorization: Bearer $AIORNOT_API_KEY' \
--form 'video=@video.mp4' \
--max-time 120
const fs = require('fs');
const FormData = require('form-data');
const fetch = require('node-fetch');
const API_KEY = process.env.AIORNOT_API_KEY;
const VIDEO_ENDPOINT = 'https://api.aiornot.com/v2/video/sync';
const form = new FormData();
form.append('video', fs.createReadStream('video.mp4'));
fetch(VIDEO_ENDPOINT, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
...form.getHeaders()
},
body: form,
timeout: 120000
})
.then(response => {
if (!response.ok) {
throw new Error(`Failed to analyze video: ${response.status} ${response.statusText}`);
}
return response.json();
})
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$API_KEY = getenv('AIORNOT_API_KEY');
$VIDEO_ENDPOINT = 'https://api.aiornot.com/v2/video/sync';
$curl = curl_init();
$videoFile = new CURLFile('video.mp4', 'video/mp4', 'video');
curl_setopt_array($curl, [
CURLOPT_URL => $VIDEO_ENDPOINT,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'video' => $videoFile
],
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $API_KEY"
],
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} elseif ($httpCode !== 200) {
echo "Failed to analyze video: HTTP $httpCode - $response";
} else {
$data = json_decode($response, true);
print_r($data);
}
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
"time"
)
func main() {
APIKey := os.Getenv("AIORNOT_API_KEY")
videoEndpoint := "https://api.aiornot.com/v2/video/sync"
file, err := os.Open("video.mp4")
if err != nil {
panic(err)
}
defer file.Close()
var requestBody bytes.Buffer
writer := multipart.NewWriter(&requestBody)
part, err := writer.CreateFormFile("video", "video.mp4")
if err != nil {
panic(err)
}
_, err = io.Copy(part, file)
if err != nil {
panic(err)
}
err = writer.Close()
if err != nil {
panic(err)
}
client := &http.Client{
Timeout: 120 * time.Second,
}
req, err := http.NewRequest("POST", videoEndpoint, &requestBody)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+APIKey)
req.Header.Set("Content-Type", writer.FormDataContentType())
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
if resp.StatusCode != 200 {
fmt.Printf("Failed to analyze video: %d %s\n", resp.StatusCode, string(body))
return
}
fmt.Println(string(body))
}
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import okhttp3.*;
public class VideoAnalysis {
public static void main(String[] args) {
String apiKey = System.getenv("AIORNOT_API_KEY");
String videoEndpoint = "https://api.aiornot.com/v2/video/sync";
OkHttpClient client = new OkHttpClient.Builder()
.readTimeout(120, TimeUnit.SECONDS)
.build();
File videoFile = new File("video.mp4");
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("video", videoFile.getName(),
RequestBody.create(MediaType.parse("video/mp4"), videoFile))
.build();
Request request = new Request.Builder()
.url(videoEndpoint)
.header("Authorization", "Bearer " + apiKey)
.post(requestBody)
.build();
try {
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) {
System.err.println("Failed to analyze video: " + response.code() + " " + response.body().string());
} else {
System.out.println(response.body().string());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
require 'uri'
require 'net/http'
url = URI("https://api.aiornot.com/v2/video/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"report": {
"ai_video": {
"is_detected": true,
"confidence": 0.95
},
"ai_voice": {
"is_detected": true,
"confidence": 0.95
},
"ai_music": {
"is_detected": true,
"confidence": 0.95
},
"meta": {
"duration": 120,
"total_bytes": 362594,
"md5": "db36d923800f6ca6b7f87cff8a19d1d1",
"audio": "processed",
"video": "processed"
},
"deepfake_video": {
"is_detected": true,
"confidence": 0.936413076150301,
"no_faces_found": false
}
},
"external_id": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}Authorizations
Query Parameters
Array of analysis types to exclude. Valid values are ai_video, ai_music, ai_voice, deepfake_video.
ai_video, ai_music, ai_voice, deepfake_video Array of analysis types to include. Valid values are ai_video, ai_music, ai_voice, deepfake_video. Note: deepfake_video is OFF by default and must be explicitly included using this parameter if you want deepfake detection.
ai_video, ai_music, ai_voice, deepfake_video An optional external identifier for tracking this video analysis.
Body
The video file to analyze. Must be a valid video file.
Supported formats include:
- 3gp
- avi
- flv
- gif
- m4v
- mkv
- mov
- mp4
- mpeg
- mpg
- mxf
- ts
- vob
- webm
- wmv
Maximum file size: 200MB
For videos with multiple audio or video tracks, only the first track of each type will be analyzed. Videos without audio are allowed - in this case, no audio analysis will be performed.