PhotoCheck API

PhotoCheck API in Python

To check a photo for AI generation and faces in Python, POST it to https://photocheckapi.com/api/v1/analyze with your key as a Bearer token. The response is JSON with ai.score, faces.count and the file's metadata. The example below is complete and runs as it is.

1. Set your key

shell
export PHOTOCHECK_API_KEY="pc_live_…"

No key yet? Leave the header out: you get 5 keyless calls a day to try it. Credit packs start at $4.95.

2. Install

shell
pip install requests

3. Check a photo

Python
import os
import requests

with open("photo.jpg", "rb") as f:
    res = requests.post(
        "https://photocheckapi.com/api/v1/analyze",
        headers={"Authorization": f"Bearer {os.environ['PHOTOCHECK_API_KEY']}"},
        files={"image": f},
        timeout=30,
    )

if res.status_code == 402:
    raise SystemExit("Out of credits")
if res.status_code == 429:
    raise SystemExit(f"Rate limited, retry in {res.headers.get('Retry-After')}s")
res.raise_for_status()

result = res.json()
print(result["summary"]["text"])
print("AI score:", result["ai"]["score"], "faces:", result["faces"]["count"])

Notes

  • httpx works the same way: swap requests.post for httpx.post.
  • For many images, reuse one requests.Session to keep the connection open.
  • Swap /analyze for /faces, /ai-detect or /metadata to run one check. Each costs the same one credit.
  • Branch on error.type rather than the HTTP status alone; the full list is in the error reference.

Other languages

cURL, JavaScript (Node.js), PHP, Go, Ruby, Java, C# (.NET), Rust.