PhotoCheck API in C# (.NET)
To check a photo for AI generation and faces in C# (.NET), 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
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. Check a photo
using System.Net.Http.Headers;
using System.Text.Json;
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("PHOTOCHECK_API_KEY"));
using var form = new MultipartFormDataContent();
var image = new ByteArrayContent(await File.ReadAllBytesAsync("photo.jpg"));
image.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
form.Add(image, "image", "photo.jpg");
var res = await http.PostAsync("https://photocheckapi.com/api/v1/analyze", form);
var json = JsonDocument.Parse(await res.Content.ReadAsStringAsync()).RootElement;
if (!res.IsSuccessStatusCode)
throw new Exception(json.GetProperty("error").GetProperty("message").GetString());
Console.WriteLine(json.GetProperty("summary").GetProperty("text").GetString());
Console.WriteLine($"AI score: {json.GetProperty("ai").GetProperty("score").GetDouble()}");Notes
- .NET 6+ with top-level statements.
- Reuse one HttpClient for the life of the app.
- Swap
/analyzefor/faces,/ai-detector/metadatato run one check. Each costs the same one credit. - Branch on
error.typerather than the HTTP status alone; the full list is in the error reference.
Other languages
cURL, JavaScript (Node.js), Python, PHP, Go, Ruby, Java, Rust.