Developer guide · Updated 13 September 2026
Add an AI check to your app.
Send an image, text or code to the isGenAI API and receive a result with the checks behind it. This working Node.js example uses private inputs, a request timeout and a small, predictable output.
1. Run a check
Install Node.js 22 or newer, then download check-content.mjs. The example needs no package installation or API key for the current public endpoint. Service limits apply.
node check-content.mjs
node check-content.mjs --text "This summary was drafted with Claude."
node check-content.mjs --code "// This function was coded using GitHub Copilot."
node check-content.mjs --file picture.pngThe command without arguments checks a clearly labelled demonstration sentence. Use --text, --code or --file to supply your own input. Each command sends one check.
2. Read the result and its basis
The default sentence states that ChatGPT was used, so the response headline is AI DETECTED with Public label as its basis. That describes a stated AI use, not a measured writing-style probability.
For images, results can also come from saved prompts, signed records or matching copies. Read adapter_runs to distinguish a completed check from one that was unavailable. NO AI SIGNAL DETECTED means that the available checks found no supporting signal; it does not certify human authorship.
The downloadable example prints the headline, basis and check statuses. It keeps submitted text, filenames and feedback tokens out of its console output.
3. Use the complete example
// isGenAI public API example. CC0-1.0. Requires Node.js 22 or newer.
// Checks one explicitly supplied file/text or the clearly labelled default example.
import { readFile, stat } from "node:fs/promises";
import { extname } from "node:path";
const [mode, value, extra] = process.argv.slice(2);
if (extra || (mode && (!["--text", "--code", "--file"].includes(mode) || !value))) {
throw new Error('Usage: node check-content.mjs [--text "words" | --code "code" | --file picture.png]');
}
const base = new URL(process.env.ISGENAI_BASE_URL || "https://isgenai.com");
if (base.username || base.password || (base.protocol !== "https:" && !(base.protocol === "http:" && ["localhost", "127.0.0.1"].includes(base.hostname)))) {
throw new Error("Use HTTPS, or HTTP localhost for a local test.");
}
let body;
let headers;
if (mode === "--file") {
const type = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp", ".avif": "image/avif" }[extname(value).toLowerCase()];
if (!type || (await stat(value)).size > 20 * 1024 * 1024) throw new Error("Use a PNG, JPEG, WebP or AVIF file up to 20 MB.");
body = new FormData();
body.set("file", new Blob([await readFile(value)], { type }), `image${extname(value).toLowerCase()}`);
body.set("privacy", "private");
body.set("source_context", "isgenai-api-example");
} else {
const text = value || "This demonstration caption was generated with ChatGPT.";
if (!text.trim() || text.length > 16000) throw new Error("Use 1 to 16,000 characters.");
body = JSON.stringify({ text, kind: mode === "--code" ? "code" : "text", privacy: "private", source_context: "isgenai-api-example" });
headers = { "content-type": "application/json" };
}
const response = await fetch(new URL("/v1/check", base), { method: "POST", headers, body, signal: AbortSignal.timeout(30000) });
if (!response.ok) throw new Error(`Check returned HTTP ${response.status}. For 429, wait before retrying; do not loop requests.`);
const result = await response.json();
if (!result.public_result?.headline || !Array.isArray(result.adapter_runs)) throw new Error("Unexpected check response.");
// Print the headline and check statuses only: no submitted content, filenames or feedback tokens.
console.log(JSON.stringify({
headline: result.public_result.headline,
basis: result.public_result.basis,
checks: result.adapter_runs.map(({ adapter, status }) => ({ adapter, status })),
}, null, 2));
4. Add the check to a review workflow
- Send one input after the user asks to check it. Set
privacy: "private"explicitly. - Show the result together with its basis and completed checks.
- Handle non-success HTTP responses separately. If you receive 429, wait before retrying; avoid automatic request loops.
- Offer a report or review action. A check should help a person examine the content, not silently penalize an author.
Text and code are limited to 16,000 characters; supported images are PNG, JPEG, WebP and AVIF up to 20 MB. The script never executes submitted code. Public URL checks are also supported by the endpoint; set their privacy explicitly because public-link defaults differ from uploads.
For a local server, set ISGENAI_BASE_URL=http://localhost:3000. For another hosted deployment, use HTTPS. The default remains https://isgenai.com.
Read the full API reference, try the image detector or open the text and code checker. The example code is CC0-1.0, so you can adapt it to your app.
5. Extract a saved image prompt without an AI model
For an image library or review tool, use mode=saved_only with POST /v1/prompt. It reads supported saved instructions from the supplied file and never falls back to generating a new prompt.
Download extract-saved-prompt.mjs, then run it with an original image. Node.js 22 or newer is required; no package installation or API key is needed.
node extract-saved-prompt.mjs picture.pngThe command sends one image to isGenAI and prints the saved prompt, optional negative prompt and recorded model name. Keep that output out of shared logs when it contains private material. The image and prompt are not added to a public report by this endpoint.
If this copy contains no supported saved prompt, the API returns HTTP 422 with no_saved_prompt; the example prints status: "not_found". No model request is made, including when reconstruction is enabled on the server. Neither outcome establishes whether the image is real or whether the saved details are authentic.
Supported records include AUTOMATIC1111 settings in PNG, JPEG and WebP, and supported ComfyUI or Flux workflows in PNG. Use the two downloadable demonstration images to compare identical pixels with and without saved instructions. Service and upload limits still apply.