Skip to the content
detectaicheck

API for developers

Check images, documents, audio and video files for signs of AI from your own server. Send one file per call and get the same report the website shows, as JSON.

Get a key

  • Sign up and confirm your email address. The API needs a confirmed email address.
  • Open Account, then API keys, and create a key. It is shown once, so store it safely.
  • Keep the key on your server. Revoke it on the same page when it leaks or is no longer needed.

Authentication

Send the key in the X-API-Key header, or as Authorization: Bearer <key>. A key in the query string is ignored, so it never ends up in a log. Always use HTTPS.

The API sends no CORS headers: it is for server side use. Never call it from a web page or put the key in browser or app code.

Endpoints

The base URL is https://detectaicheck.com/api/v1. Every answer is JSON and is never cached.

EndpointWhat it does
POST /analyzeRuns every check that fits the file: Content Credentials and AI metadata, the structure and hidden text marks of documents, and on JPEG, PNG, WebP and GIF pictures the invisible watermark and the AI image classifier. Costs 1 credit per started 10 MB of the file.
POST /verifyChecks the Content Credentials of a file only. Costs 1 credit per started 10 MB of the file.
GET /usageYour credit balance and your last 20 credit changes. Free of charge.
GET /healthWhether the service is up and the image model is ready. No key needed.
GET /openapi.jsonThe OpenAPI 3.1 description of the API. No key needed.

Send the file as multipart/form-data in the field file, or as the request body with the Content-Type of the file (for example image/jpeg or application/pdf) and an optional ?name=photo.jpg for the report. Download the OpenAPI document.

The report

verdict is the answer, summary explains it with a confidence and the reasons, and findings hold the evidence of every check. The verdict is one of:

VerdictMeaning
NoEvidenceNo sign of AI was found. This is not proof that a person made the file.
LikelyAIThe classifier or other signals point to AI, without hard evidence.
AIEditedThere is evidence that AI edited the file.
AIGeneratedThere is evidence that AI made the file.
CapturedSignedValid Content Credentials say a camera or app captured the file.

Errors

An error is JSON too: {"error":"text for people","code":"machine_code"}. Check the HTTP status and the code.

StatusCodeMeaning
400bad_requestThe body cannot be read or has no file. Costs nothing.
400files_onlyText was sent. The API checks files only. Costs nothing.
400unsupported_typeThe file type cannot be read. The supported types are listed below. Costs nothing.
401unauthorizedNo key, an unknown key or a revoked key.
402insufficient_creditsYour credit balance is too low for the file. Buy a credit pack. Costs nothing.
403forbiddenThe email address is not confirmed yet, or the account is disabled.
404not_foundThere is no such endpoint.
405method_not_allowedWrong HTTP method, see the Allow header.
413too_largeThe file is larger than 50 MB. Costs nothing.
429rate_limitedToo many requests from your connection. Wait a few seconds. Costs nothing.
500analysis_failedThe analysis could not be completed. The credits are given back.
503busyMany files are being analyzed. Wait Retry-After seconds. The credits are given back.
504timeoutThe analysis took longer than 120 seconds. The credits are given back.

Credits

The API is paid with credits. A call costs 1 credit per started 10 MB of the file, at least 1 credit: a 1 MB photo costs 1 credit, a 25 MB video 3 credits and a 50 MB file 5 credits. A new account gets 100 credits free when its email address is confirmed. Credit packs never expire. See the credit packs.

Every answer to a call with a key carries X-Credits-Charged, what the call cost, and X-Credits-Remaining, your balance afterwards. Calls refused for bad input, a file that is too large or a low balance cost nothing. When the analysis fails, times out or finds the service busy, the credits are given back. Checks on the website are free and never use credits.

Limits

Files only, no text: images (JPEG, PNG, WebP, GIF, TIFF, HEIC, AVIF), documents (PDF, DOCX, XLSX, PPTX, ODT, ODS, ODP), audio (WAV, MP3, OGG, FLAC, M4A) and video (MP4, MOV, AVI). See which checks run on each type.

  • Up to 50 MB per file.
  • One file per request.
  • Calls are synchronous: the answer comes when the analysis is done, after up to 120 seconds. Set your client timeout a little higher.

Privacy

Files sent to the API are analyzed and deleted as soon as the answer is sent. We keep neither the file nor the report, only the credits each call cost. Read the privacy policy.

Samples

Each sample analyzes photo.jpg and reads the key from the environment variable DETECTAICHECK_API_KEY.

cURL

From a shell, with the key in an environment variable.

curl -sS "https://detectaicheck.com/api/v1/analyze" \
  -H "X-API-Key: $DETECTAICHECK_API_KEY" \
  -F "file=@photo.jpg"

Python

Python 3, standard library only. The file goes as the raw body.

import json
import os
import urllib.request

with open("photo.jpg", "rb") as f:
    image = f.read()

request = urllib.request.Request(
    "https://detectaicheck.com/api/v1/analyze?name=photo.jpg",
    data=image,
    method="POST",
    headers={
        "X-API-Key": os.environ["DETECTAICHECK_API_KEY"],
        "Content-Type": "image/jpeg",
    },
)
with urllib.request.urlopen(request, timeout=150) as response:
    report = json.load(response)

print(report["verdict"])

JavaScript (Node.js 18 or later)

Save it as analyze.mjs and run node analyze.mjs.

import { readFile } from "node:fs/promises";

const image = await readFile("photo.jpg");
const form = new FormData();
form.append("file", new Blob([image], { type: "image/jpeg" }), "photo.jpg");

const response = await fetch("https://detectaicheck.com/api/v1/analyze", {
  method: "POST",
  headers: { "X-API-Key": process.env.DETECTAICHECK_API_KEY },
  body: form,
});
const report = await response.json();
if (!response.ok) {
  throw new Error(`${report.code}: ${report.error}`);
}
console.log(report.verdict);

PHP

With the curl extension.

<?php
$ch = curl_init("https://detectaicheck.com/api/v1/analyze");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: " . getenv("DETECTAICHECK_API_KEY")],
    CURLOPT_POSTFIELDS => ["file" => new CURLFile("photo.jpg", "image/jpeg")],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 150,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

$report = json_decode($body, true);
if ($status !== 200) {
    exit($report["code"] . ": " . $report["error"] . "\n");
}
echo $report["verdict"], "\n";

C#

.NET 6 or later, as the Program.cs of a console app.

using System.Net.Http.Headers;
using System.Text.Json;

using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(150) };
http.DefaultRequestHeaders.Add("X-API-Key",
    Environment.GetEnvironmentVariable("DETECTAICHECK_API_KEY"));

using var form = new MultipartFormDataContent();
var image = new ByteArrayContent(File.ReadAllBytes("photo.jpg"));
image.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
form.Add(image, "file", "photo.jpg");

using var response = await http.PostAsync("https://detectaicheck.com/api/v1/analyze", form);
using var report = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
if (!response.IsSuccessStatusCode)
{
    throw new Exception(report.RootElement.GetProperty("code").GetString());
}
Console.WriteLine(report.RootElement.GetProperty("verdict").GetString());

Java

Java 11 or later. Save it as Analyze.java and run java Analyze.java.

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;
import java.time.Duration;

public class Analyze {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://detectaicheck.com/api/v1/analyze?name=photo.jpg"))
            .version(HttpClient.Version.HTTP_1_1)
            .timeout(Duration.ofSeconds(150))
            .header("X-API-Key", System.getenv("DETECTAICHECK_API_KEY"))
            .header("Content-Type", "image/jpeg")
            .POST(HttpRequest.BodyPublishers.ofFile(Path.of("photo.jpg")))
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}

Go

Standard library only.

package main

import (
	"bytes"
	"fmt"
	"io"
	"mime/multipart"
	"net/http"
	"os"
	"time"
)

func main() {
	var body bytes.Buffer
	form := multipart.NewWriter(&body)
	part, err := form.CreateFormFile("file", "photo.jpg")
	if err != nil {
		panic(err)
	}
	image, err := os.Open("photo.jpg")
	if err != nil {
		panic(err)
	}
	defer image.Close()
	if _, err := io.Copy(part, image); err != nil {
		panic(err)
	}
	form.Close()

	request, err := http.NewRequest("POST", "https://detectaicheck.com/api/v1/analyze", &body)
	if err != nil {
		panic(err)
	}
	request.Header.Set("X-API-Key", os.Getenv("DETECTAICHECK_API_KEY"))
	request.Header.Set("Content-Type", form.FormDataContentType())

	client := &http.Client{Timeout: 150 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()
	report, _ := io.ReadAll(response.Body)
	fmt.Println(response.StatusCode, string(report))
}

Delphi

Delphi 10.3 or later, a console program.

program Analyze;

{$APPTYPE CONSOLE}

uses
  System.SysUtils, System.JSON, System.Net.URLClient, System.Net.HttpClient,
  System.Net.Mime;

var
  oClient: THTTPClient;
  oForm: TMultipartFormData;
  oResponse: IHTTPResponse;
  oReport: TJSONValue;
begin
  oClient := THTTPClient.Create;
  oForm := TMultipartFormData.Create;
  try
    oClient.ResponseTimeout := 150000;
    oForm.AddFile('file', 'photo.jpg', 'image/jpeg');
    oResponse := oClient.Post('https://detectaicheck.com/api/v1/analyze', oForm, nil,
      [TNetHeader.Create('X-API-Key',
      GetEnvironmentVariable('DETECTAICHECK_API_KEY'))]);
    oReport := TJSONObject.ParseJSONValue(oResponse.ContentAsString);
    try
      if oResponse.StatusCode = 200 then
        Writeln(oReport.GetValue<string>('verdict'))
      else
        Writeln(oResponse.StatusCode, ' ', oReport.GetValue<string>('code'));
    finally
      oReport.Free;
    end;
  finally
    oForm.Free;
    oClient.Free;
  end;
end.