What the API does
The Scanon API detects and redacts personally identifiable information: faces, license plates and screens in images and video, and sensitive data (SSNs, credit card and bank routing numbers, IBANs, emails and phone numbers) in documents. Send it a file, get back a redacted one. It's the same detection engine that powers the Scanon web app, available programmatically.
The API is identical for individual and business accounts. The only differences are your rate-limit tier and credit balance, both tied to your account's plan.
Authentication
Create a key from your Business Dashboard or account page, then send it as a bearer token on every request:
Authorization: Bearer scanon_your_api_keyKeys that are missing, malformed or revoked get a 401.
Code examples
Pick a language once and every sample on this page switches with it.
Images, synchronous
POST /v1/images returns the redacted image directly.
| Param | Type | Default | Notes |
|---|---|---|---|
file | multipart file | required | Max 10MB. Must be an image content type. |
detect_faces | form boolean | true | — |
detect_plates | form boolean | false | — |
detect_tattoos | form boolean | false | Blurs screen and tattoo-class regions. |
encryption_mode | form string | "normal" | "normal" or "cryptographic". Anything else returns 400. |
On 200 the response body is the redacted image as raw image/png bytes, not JSON. The X-Image-Credits-Remaining header reports your balance after the call. On any other status the body is JSON (see Errors).
encryption_mode="cryptographic" AES-scrambles each detected region with a fresh, never-stored key before blurring on top, so the original pixels are unrecoverable, not just visually hidden. It costs 2 credits instead of 1. An unrecognized value is rejected with 400 rather than silently falling back to normal blur.
# curl's -o writes the response body to disk no matter the status code.
# Write to a temp file first and only keep it if the status was 200 - on
# error the body is JSON (e.g. {"detail": "Insufficient credits"}), not a PNG.
STATUS=$(curl -s -o /tmp/scanon_response -w "%{http_code}" \
-X POST https://api.scanon.ai/v1/images \
-H "Authorization: Bearer scanon_your_api_key" \
-F "file=@photo.jpg" \
-F "detect_faces=true" \
-F "detect_plates=false" \
-F "detect_tattoos=false" \
-F "encryption_mode=normal")
# Change encryption_mode to "cryptographic" for AES-scrambled (irreversible)
# redaction - costs 2 image credits instead of 1.
if [ "$STATUS" -eq 200 ]; then
mv /tmp/scanon_response redacted.png
echo "Saved redacted.png"
else
echo "Request failed with status $STATUS:"
cat /tmp/scanon_response
exit 1
fiVideos, asynchronous
Submit, poll, then fetch the result.
1. POST /v1/videos
Accepts file (multipart, required) and encryption_mode (form string, "normal" or "cryptographic", default "normal"). Returns {"job_id": "...", "status": "queued"} immediately.
# Requires jq (https://jqlang.org) for JSON parsing.
API_KEY="scanon_your_api_key"
JOB=$(curl -s -X POST https://api.scanon.ai/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-F "file=@video.mp4" \
-F "encryption_mode=normal")
JOB_ID=$(echo "$JOB" | jq -r '.job_id')
echo "Submitted job $JOB_ID"2. GET /v1/videos/{job_id}
Returns status (queued → processing → done, failed or cancelled), progress (0–100, or null) and error (set when status is failed). Poll every few seconds until you reach a terminal status.
# Poll every 4s with a sensible max wait - never a tight loop
POLL_INTERVAL=4
MAX_WAIT=300
WAITED=0
STATUS="queued"
while [ "$STATUS" != "done" ] && [ "$STATUS" != "failed" ] && [ "$STATUS" != "cancelled" ]; do
sleep "$POLL_INTERVAL"
WAITED=$((WAITED + POLL_INTERVAL))
if [ "$WAITED" -ge "$MAX_WAIT" ]; then
echo "Timed out waiting for job $JOB_ID"
exit 1
fi
POLL=$(curl -s "https://api.scanon.ai/v1/videos/$JOB_ID" -H "Authorization: Bearer $API_KEY")
STATUS=$(echo "$POLL" | jq -r '.status')
echo "status=$STATUS progress=$(echo "$POLL" | jq -r '.progress')"
done
if [ "$STATUS" != "done" ]; then
echo "Job did not complete: $(echo "$POLL" | jq -r '.error')"
exit 1
fi3. GET /v1/videos/{job_id}/result
Returns the redacted video as raw video/mp4 bytes. Read Result lifecycle before you call it: the file can be fetched once.
# Single fetch only - a second call to /result returns 410
HTTP_STATUS=$(curl -s -o redacted.mp4 -w "%{http_code}" \
"https://api.scanon.ai/v1/videos/$JOB_ID/result" \
-H "Authorization: Bearer $API_KEY")
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Saved redacted.mp4"
else
echo "Fetch failed ($HTTP_STATUS) - result may have expired or already been retrieved"
exit 1
fiNote: detect_faces, detect_plates and detect_tattoos apply to images only. Video submissions currently redact every supported class (faces, plates, screens) regardless of these flags. Per-request filtering for video is planned but not yet available.
Documents, asynchronous
Submit, poll, then fetch the result. Supported formats: PDF, DOCX, PPTX, XLSX, ODT, TXT or MD. Detect and redact are separate endpoints: POST /v1/documents/detect returns findings only and never modifies the file; POST /v1/documents/redact returns findings plus a redacted file to fetch. Both accept the same file and policy multipart body.
1. POST /v1/documents/detect or /redact
Accepts file (multipart, required; max 25MB; non-PDF formats are converted to PDF server-side before detection runs) and policy (form string, optional JSON, see Policy). Returns {"job_id": "...", "status": "processing", "page_count": N} immediately. page_count is also the number of document credits just deducted, since documents are billed per page, not per file.
# Requires jq (https://jqlang.org) for JSON parsing.
API_KEY="scanon_your_api_key"
# policy is a JSON string sent as a regular form field alongside the file.
# entities/per_entity/page_range/strip_metadata are all optional - omitting
# policy entirely scans every supported entity type on every page.
POLICY='{
"entities": ["ssn", "credit_card", "email", "phone"],
"per_entity": {
"ssn": { "action": "redact" },
"credit_card": { "action": "mask" }
},
"page_range": [1, 10],
"strip_metadata": true,
"issue_certificate":true
}'
# Detect only - findings back, file untouched:
# POST https://api.scanon.ai/v1/documents/detect
JOB=$(curl -s -X POST https://api.scanon.ai/v1/documents/redact \
-H "Authorization: Bearer $API_KEY" \
-F "file=@statement.pdf" \
-F "policy=$POLICY")
JOB_ID=$(echo "$JOB" | jq -r '.job_id')
echo "Submitted job $JOB_ID"2. GET /v1/documents/{job_id}
Returns status (processing → done, failed or cancelled) and, once done, the manifest: entity counts, a per-page breakdown, and each finding's page, bounding box, confidence and which recognizer fired. The matched sensitive value itself is never included anywhere in this response.
For a redact job it also includes doc_id (the document ID stamped into the redaction certificate), signed (whether a certificate was generated and signed) and signing_reason (set when signed is not true, explaining why). If the request didn't set issue_certificate: true, doc_id and signed are both null, with signing_reason: "not_requested".
# Poll every 4s with a sensible max wait - never a tight loop
POLL_INTERVAL=4
MAX_WAIT=300
WAITED=0
STATUS="queued"
while [ "$STATUS" != "done" ] && [ "$STATUS" != "failed" ] && [ "$STATUS" != "cancelled" ]; do
sleep "$POLL_INTERVAL"
WAITED=$((WAITED + POLL_INTERVAL))
if [ "$WAITED" -ge "$MAX_WAIT" ]; then
echo "Timed out waiting for job $JOB_ID"
exit 1
fi
POLL=$(curl -s "https://api.scanon.ai/v1/documents/$JOB_ID" -H "Authorization: Bearer $API_KEY")
STATUS=$(echo "$POLL" | jq -r '.status')
echo "status=$STATUS"
done
if [ "$STATUS" != "done" ]; then
echo "Job did not complete: $(echo "$POLL" | jq -r '.error')"
exit 1
fi
# The manifest (entity counts, per-page breakdown, bboxes, confidence) is
# embedded in this same response once status is "done" - never the matched
# values themselves, only where and what type was found.
echo "$POLL" | jq '.manifest'3. GET /v1/documents/{job_id}/result
Returns the redacted document as raw application/pdf bytes. Redact jobs only: a detect job has no file to fetch and this returns 409. Read Result lifecycle before you call it.
# Redact jobs only - detect jobs never modify the file and return 409 here.
# Single fetch only - a second call to /result returns 410
HTTP_STATUS=$(curl -s -o redacted.pdf -w "%{http_code}" \
"https://api.scanon.ai/v1/documents/$JOB_ID/result" \
-H "Authorization: Bearer $API_KEY")
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Saved redacted.pdf"
else
echo "Fetch failed ($HTTP_STATUS) - result may have expired, already been retrieved, or this was a detect-only job"
exit 1
fiPolicy
Every field is optional. Omitting policy scans every supported entity on every page with the default action, redact.
{
"entities": ["ssn", "credit_card", "email", "phone"],
"per_entity": {
"ssn": { "action": "redact" },
"credit_card": { "action": "mask" }
},
"page_range": [1, 10],
"strip_metadata": true,
"issue_certificate":true
}entities: array ofssn,credit_card,aba_routing,iban,email,phone.per_entity: per-typethreshold(0–1, default 0.75) andaction(redact,mask,hash,labelornone). Onlyredactphysically removes the underlying text; the others still detect but leave it in place or cover it with a masked, hashed or labeled overlay.page_range:[start, end], 1-indexed and inclusive. Omit to scan every page.strip_metadata: boolean, defaulttrue. Redact jobs only.issue_certificate: boolean, defaultfalse. Redact jobs only. Settrueto get a redaction certificate appended to the result.
Redaction certificate
A redact job can append one or more certificate pages to the end of the PDF returned by GET /v1/documents/{job_id}/result. The certificate lists the document ID, the generation timestamp, a QR code and link to the public verify page, a per-category count of the regions removed, and the hashing and signing method. It never discloses the redacted content. The stamped file is hashed and signed after the certificate is added, so the certificate is covered by the same signature as the rest of the document.
Certificates are opt-in on the API and off by default: set issue_certificate: true in policy to get one. Omit it, or set it to false, and the redacted file comes back with no certificate pages.
Certificates generated through the API carry a small attribution line near the foot of the page, “Redacted using scanon API”, distinguishing them from certificates produced by the web app. Anyone with the PDF or its QR code can confirm authenticity at the verify URL without API access.
Note: DOCX, PPTX, XLSX and ODT uploads are converted to PDF before detection runs. An embedded image (for example a scanned page pasted into a Word file) is still just pixels after conversion, so it's evaluated exactly like a scanned PDF page: if OCR can't read it, that page is listed in ocr_unavailable_pages in the manifest rather than silently reporting zero findings.
Rate limits
Each key gets a token bucket per endpoint. Burst is how many calls you can fire back to back before you're throttled; the bucket then refills at a fixed rate up to that same ceiling. Your tier is your account's plan (Free, Pro or Team), resolved automatically with no configuration.
| Tier | Images | Videos | Documents |
|---|---|---|---|
| Free | 20 burst · +1 every 30s (~120/hr) | 2 burst · +1 every 15 min (~4/hr) | 10 burst · +1 every 60s (~60/hr) |
| Pro | 100 burst · +1 every 5s (~720/hr) | 10 burst · +1 every 3 min (~20/hr) | 50 burst · +1 every 10s (~360/hr) |
| Team | 300 burst · +1 every 2s (~1,800/hr) | 20 burst · +1 every 90s (~40/hr) | 150 burst · +1 every 4s (~900/hr) |
Video limits are intentionally capped near total processing capacity, so they won't move much even on higher tiers. Going over returns 429 with a Retry-After header (seconds to wait) plus X-RateLimit-Limit and X-RateLimit-Remaining. Limits are checked before credits are deducted, so a throttled request never costs a credit.
Errors
Every non-2xx response is JSON in this shape. Check the status code before treating the response body as a result:
{
"detail": "Insufficient credits"
}| Status | Meaning | Example detail |
|---|---|---|
400 | Bad request: not an image, or the file couldn’t be decoded. | "File must be an image" |
401 | API key missing, malformed or revoked. | "Invalid or revoked API key" |
402 | Not enough credits for this call. | "Insufficient credits" |
404 | Job doesn’t exist, or belongs to a different key. | "Job not found" |
409 | /result called before the job reached done, or on a document detect job. | "Job not ready (status: processing)" |
410 | Result already fetched once, or its 10-minute window expired. | "Result expired or already retrieved" |
413 | Document over the 25MB upload limit. | "Document exceeds maximum upload size (25MB)" |
415 | Unsupported file type (see supported formats above). | "Unsupported file type '.zip'. Supported: .docx, .md, .odt, .pdf, .pptx, .txt, .xlsx" |
422 | A DOCX, PPTX, XLSX, ODT, TXT or MD upload that failed to convert to PDF (corrupt file, conversion error). | "Could not convert document to PDF: ..." |
429 | Rate limit reached for your tier. See Retry-After. | "Rate limit reached for your free plan..." |
500 | Unexpected server error during redaction. | "Redaction failed: ..." |
Credits
- API calls draw from your account's credit balance; there is no separate API pool. Images redacted in the web app and browser extension are unlimited, but API image calls use image credits.
- Images cost 1 credit, or 2 credits with
encryption_mode="cryptographic". - Videos cost 1 credit, or 2 credits with
encryption_mode="cryptographic". - Credits are deducted atomically before processing starts. If an image redaction fails unexpectedly (
500), the credits charged for that call are refunded automatically: 2 for cryptographic mode, 1 otherwise. - Documents are billed by page, not by file:
page_countdocument credits are deducted per call (a 10-page PDF costs 10 credits, detect or redact). The page count is only known once the file is opened, so credits are deducted right after that, before detection runs, and refunded in full if the job fails. - A
402(insufficient credits) or429(rate limited) never deducts a credit.
Result lifecycle
Applies to videos and documents: single fetch, then it's gone.
- Once a job reaches
status: "done", the redacted video or document is held for 10 minutes. GET /v1/videos/{job_id}/resultandGET /v1/documents/{job_id}/resultdelete the cached file as soon as they have streamed it. Fetch it once and save it. A second call, or a call after the 10-minute window, returns410.- A document
detectjob never has a file, so calling/resulton one returns409regardless of timing. - Jobs that go more than about 2 minutes without a status poll are treated as abandoned and cancelled. Keep polling every few seconds until you see a terminal status.