Docs / AI Content Detection / Deepfake Detection

Deepfake Detection

deepfake

Detect if an image or video is a DeepFake. Deepfakes are defined as cases where a face in an image has been swapped or modified to look like another person.

Overview

The Deepfake Detection Model can help you determine if an image or video is a deepfake. Deepfakes are defined as cases where a face in an image has been swapped or modified to look like another person.

The Model works by looking at the most prominent faces in the image or video and checking if at least one of the faces is a DeepFake. The model was trained to work with photographic imagery.

Deepfake
On the left: a real (non-deepfake) image. On the right: a deepfake.

How about synthetic images and AI-generated imagery?

This model focuses on real photographic images/videos in which faces have been swapped or modified to make them look like someone else.

In order to detect AI-generated images, you can use the AI-Generated Image Detection Model.

Use cases

  • Tag deepfake imagery as such, to limit the spread of misinformation and fake news
  • Implement stricter moderation rules on deepfakes
  • Detect potential fraud such as impersonation, fake ids
  • Enact bans on deepfakes

Use the model

If you haven't already, create an account to get your own API keys.

Detect if an image is a deepfake

Let's say you want to check the following image:

You can either send the image URL, or upload the raw binary image.

Option 1: Send image URL

Here's how to proceed if you choose to share the image URL:


curl -X GET -G 'https://api.sightengine.com/1.0/check.json' \
    -d 'models=deepfake' \
    -d 'api_user={api_user}&api_secret={api_secret}' \
    --data-urlencode 'url=https://sightengine.com/assets/img/examples/example-fac-1000.jpg'


# this example uses requests
import requests
import json

params = {
  'url': 'https://sightengine.com/assets/img/examples/example-fac-1000.jpg',
  'models': 'deepfake',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
}
r = requests.get('https://api.sightengine.com/1.0/check.json', params=params)

output = json.loads(r.text)


$params = array(
  'url' =>  'https://sightengine.com/assets/img/examples/example-fac-1000.jpg',
  'models' => 'deepfake',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',
);

// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/check.json?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$output = json_decode($response, true);


// this example uses axios
const axios = require('axios');

axios.get('https://api.sightengine.com/1.0/check.json', {
  params: {
    'url': 'https://sightengine.com/assets/img/examples/example-fac-1000.jpg',
    'models': 'deepfake',
    'api_user': '{api_user}',
    'api_secret': '{api_secret}',
  }
})
.then(function (response) {
  // on success: handle response
  console.log(response.data);
})
.catch(function (error) {
  // handle error
  if (error.response) console.log(error.response.data);
  else console.log(error.message);
});

See request parameter description

ParameterTypeDescription
urlstringURL of the image to analyze
modelsstringcomma-separated list of models to apply
api_userstringyour API user id
api_secretstringyour API secret

Option 2: Send raw image

Here's how to proceed if you choose to upload the raw image:


curl -X POST 'https://api.sightengine.com/1.0/check.json' \
    -F 'media=@/path/to/image.jpg' \
    -F 'models=deepfake' \
    -F 'api_user={api_user}' \
    -F 'api_secret={api_secret}'


# this example uses requests
import requests
import json

params = {
  'models': 'deepfake',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
}
files = {'media': open('/path/to/image.jpg', 'rb')}
r = requests.post('https://api.sightengine.com/1.0/check.json', files=files, data=params)

output = json.loads(r.text)


$params = array(
  'media' => new CurlFile('/path/to/image.jpg'),
  'models' => 'deepfake',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',
);

// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/check.json');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = curl_exec($ch);
curl_close($ch);

$output = json_decode($response, true);


// this example uses axios and form-data
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

data = new FormData();
data.append('media', fs.createReadStream('/path/to/image.jpg'));
data.append('models', 'deepfake');
data.append('api_user', '{api_user}');
data.append('api_secret', '{api_secret}');

axios({
  method: 'post',
  url:'https://api.sightengine.com/1.0/check.json',
  data: data,
  headers: data.getHeaders()
})
.then(function (response) {
  // on success: handle response
  console.log(response.data);
})
.catch(function (error) {
  // handle error
  if (error.response) console.log(error.response.data);
  else console.log(error.message);
});

See request parameter description

ParameterTypeDescription
mediafileimage to analyze
modelsstringcomma-separated list of models to apply
api_userstringyour API user id
api_secretstringyour API secret

Response

The API will then return a JSON response with the deepfake score. This score is a float between 0 and 1. The higher the value, the higher the confidence that the image is a deepfake:

                
                
{
    "status": "success",
    "request": {
        "id": "req_0zrbHDeitGYY7wEGncAne",
        "timestamp": 1491402308.4762,
        "operations": 1
    },
    "type": {
      "deepfake": 0.01
    },
    "media": {
        "id": "med_0zrbk8nlp4vwI5WxIqQ4u",
        "uri": "https://sightengine.com/assets/img/examples/example-fac-1000.jpg"
    }
}
                
            

Frequently asked questions

What exactly counts as a deepfake?

A deepfake is a real photo or video in which one or more faces have been swapped or AI-modified to look like another person. The rest of the scene is genuine, only the face has been manipulated. Fully synthetic content where the entire image is AI-generated is handled by AI-generated Image Detection and AI-generated Video Detection.

How is deepfake detection different from AI image or video detection?

Deepfake detection looks for manipulated faces inside an otherwise real image or video. AI-generated detection looks for content produced entirely by a generative model. The two are complementary: combining them in a single API call gives you broader coverage of synthetic and manipulated media.

Does it work on images with multiple faces?

Yes. The model evaluates the two most prominent faces and returns a score reflecting the highest deepfake confidence detected on those faces.

What does the deepfake score mean?

It is the model's confidence, from 0 to 1, that at least one face in the image has been swapped or AI-modified. Higher means more likely a deepfake. Scores above 0.5 typically indicate a deepfake; tune the threshold to your precision/recall preference.

Does it detect partial face manipulations such as expression edits?

The model is optimized for identity-level manipulations (face swaps, AI-generated impersonations). Subtle retouching such as smoothing, makeup or expression tweaks generally does not trigger a high deepfake score.

Does it work on low-quality, compressed or socially-shared media?

Yes. Detection is robust to re-encoding, resizing, frame-rate changes and standard social-platform recompression. Confidence may drop somewhat on heavily degraded inputs, but the model is specifically developed to handle real-world redistribution artifacts.

Will the model flag drawings, cartoons or AI-generated faces?

No. The model is designed to focus on photographic imagery. Cartoons, drawings or fully AI-generated images are not the target of this model — use AI-generated Image Detection for synthetic imagery.

Can I call this model together with other Sightengine models?

Yes. Pass a comma-separated list in the models parameter: models=deepfake,genai,nudity-2.1 and the API will return all results in a single response. This is the recommended pattern for production pipelines.

Next steps