Hopp til innholdet
DeclassifAI
  • Funksjoner
  • Bruksområder
  • Sikkerhet
  • Utviklere
  • Planer
Logg innKom i gang gratis
  • Funksjoner
  • Bruksområder
  • Sikkerhet
  • Utviklere
  • Planer
Logg innKom i gang gratis
  1. Forsiden
  2. API-dokumentasjon

API · api.declassifai.com

DeclassifAI-API-et

DeclassifAI-API-et er et REST-API på api.declassifai.com som finner personopplysninger i dokumenter og bilder og fjerner dem fra selve filen. Du sender filer med API-nøkkelen din og får tilbake funnene i 59 kategorier, lest av motorene du velger (Fast, Standard eller Advanced), og sladdede dokumenter som er kontrollert før de leveres. Alt kjører i Microsoft Azure Norway East.

Referansen under er på engelsk, slik feltnavnene, rutene og feilkodene i API-et er. Overskriftene og veiledningene her øverst er på norsk.

Adresse
https://api.declassifai.com
Nøkkel
raw-api-key-headeren
Dokumenter
PDF (også skannet), DOCX, PPTX, XLSX, CSV, JSON, TXT, MD, HTML, EML · opptil 10 per forespørsel
Bilder
JPEG, PNG, WebP · slettes innen 2 timer
Motorer
Fast (vår egen norske modell), Standard (en GLiNER-modell vi har finjustert), Advanced (Azure OpenAI gpt-4o i Norway East)
Svar
JSON; sladdede filer i sitt eget format, en ZIP for flere filer
Start gratis og lag en nøkkelKom i gang

På denne siden

  1. Kom i gang
  2. Autentisering
  3. Finne personopplysninger i tekst
  4. Sladding
  5. Referanse for rutene
    1. Text detection
      1. POST/batch/text
      2. POST/text/detect
    2. Search, extract and redact
      1. POST/batch/search
      2. POST/batch/find_words
      3. POST/extract
      4. POST/redact
      5. POST/batch/redact
      6. POST/text/redact
      7. POST/pdf/redact
      8. POST/pdf/extract
    3. Photos
      1. POST/images
      2. POST/images/{image_id}/detect
      3. POST/images/{image_id}/redact
      4. GET/images/outputs/{output_id}
      5. DELETE/images/{image_id}
    4. Status and help
      1. GET/status
      2. GET/health
      3. GET/help/engines
      4. GET/help/text-categories
      5. GET/help/visual-types
      6. GET/help/routes
      7. GET/help/detectors-status
      8. GET/help/entities
      9. GET/help/entity-examples
    5. Deprecated detection routes
      1. POST/detect/fast
      2. POST/detect/standard
      3. POST/detect/advanced
      4. POST/batch/detect
      5. POST/batch/multi_detect
  6. Feil
  7. Grenser for antall forespørsler
  8. Forbruk og fakturering i headerne
  9. Endringslogg
  10. Prøv selv
På denne siden
  1. Kom i gang
  2. Autentisering
  3. Finne personopplysninger i tekst
  4. Sladding
  5. Referanse for rutene
    1. Text detection
      1. POST/batch/text
      2. POST/text/detect
    2. Search, extract and redact
      1. POST/batch/search
      2. POST/batch/find_words
      3. POST/extract
      4. POST/redact
      5. POST/batch/redact
      6. POST/text/redact
      7. POST/pdf/redact
      8. POST/pdf/extract
    3. Photos
      1. POST/images
      2. POST/images/{image_id}/detect
      3. POST/images/{image_id}/redact
      4. GET/images/outputs/{output_id}
      5. DELETE/images/{image_id}
    4. Status and help
      1. GET/status
      2. GET/health
      3. GET/help/engines
      4. GET/help/text-categories
      5. GET/help/visual-types
      6. GET/help/routes
      7. GET/help/detectors-status
      8. GET/help/entities
      9. GET/help/entity-examples
    5. Deprecated detection routes
      1. POST/detect/fast
      2. POST/detect/standard
      3. POST/detect/advanced
      4. POST/batch/detect
      5. POST/batch/multi_detect
  6. Feil
  7. Grenser for antall forespørsler
  8. Forbruk og fakturering i headerne
  9. Endringslogg
  10. Prøv selv

Kom i gang

  1. Lag en nøkkelÅpne API-nøkler i DeclassifAI og lag en. Den vises én gang: legg den blant hemmelighetene på serveren din. En nøkkel varer i 30, 90, 180 eller 365 dager, og du kan trekke den tilbake samme sted.
  2. Finn det som står i en filSend filen til POST /batch/text med kategoriene du ser etter og motorene som skal lese dem. Send text=true hvis du skal sladde et annet format enn PDF.
  3. Les dekningenHver fil sier, for hver kategori, om den ble lest. not_checked betyr at ingen leste de sidene for den kategorien: regn dem som ikke gjennomgått, aldri som rene.
  4. SladdSend filen og redaction_mapping du har beholdt til POST /redact. Resultatet kontrolleres før du får det; en fil som ikke består kontrollen, blir ikke levert.
curl -X POST https://api.declassifai.com/batch/text \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@letter.pdf" \
  -F 'categories=["PERSON", "NATIONAL_ID", "HEALTH"]' \
  -F 'engines=["fast", "standard"]' \
  -F 'text=true'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("files", open("letter.pdf", "rb"))]
data = {
    "categories": "[\"PERSON\", \"NATIONAL_ID\", \"HEALTH\"]",
    "engines": "[\"fast\", \"standard\"]",
    "text": "true",
}

response = requests.post("https://api.declassifai.com/batch/text", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("files", await openAsBlob("letter.pdf"), "letter.pdf");
body.append("categories", "[\"PERSON\", \"NATIONAL_ID\", \"HEALTH\"]");
body.append("engines", "[\"fast\", \"standard\"]");
body.append("text", "true");
const response = await fetch("https://api.declassifai.com/batch/text", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());

Autentisering

Send nøkkelen i raw-api-key-headeren i hver forespørsel. GET /status, GET /health og hjelperutene trenger ingen nøkkel, unntatt GET /help/visual-types.

Header
raw-api-key: $DECLASSIFAI_API_KEY

Hold nøkkelen på serveren. En nøkkel i en nettside eller en mobilapp kan leses av alle. Ruter som leser eller sladder filer, krever en aktiv plan bak nøkkelen; uten den svarer de 402.

En forespørsel uten nøkkel, eller med en ugyldig nøkkel, får svaret 401:

401 · SECURITY_AUTHENTICATION_REQUIRED
{
  "error": {
    "code": "SECURITY_AUTHENTICATION_REQUIRED",
    "message": "Authentication required for this endpoint",
    "details": {
      "resource_type": "api_key/session_key"
    },
    "trace_id": "trace_1763283600_1a2b3c4d",
    "timestamp": "2026-11-16T09:00:00.000000+00:00Z"
  },
  "status": "error",
  "status_code": 401
}

Finne personopplysninger i tekst

Ask for categories, then choose which engines read them. The routes are POST /batch/text for files and POST /text/detect for a text string.

A request

categories is a JSON array of category ids, or ["ALL"] for all 59. engines is a JSON array of one to three of fast, standard and advanced. Both are required. There is no default engine, so you never get an engine you did not choose. A list that selects nothing is refused with a 422; it is never answered as "nothing found".

curl
curl -X POST https://api.declassifai.com/batch/text \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@letter.pdf" \
  -F 'categories=["PERSON","NATIONAL_ID","HEALTH"]' \
  -F 'engines=["fast","standard"]' \
  -F 'text=true'

Each finding carries one category, the engines that found it (rules for the pattern rules) and its score, the highest of engine_scores. The field entity_type repeats category and is deprecated. With pages you read only some pages of a file, for example to run the pages that were not checked again with another engine.

Engines

An engine is a choice of speed, depth and where the text goes, not of vocabulary: every engine reads the same list of categories. Switch on one engine, or several; where several are on, the routing table decides which of them read each category.

  • Fast Our own Norwegian model, with the pattern rules. The quickest, and the default in the app (the API has none: you name the engines). Runs on our servers in Norway East.
  • Standard A GLiNER model we fine-tuned. A balance of speed and depth. Runs on our servers in Norway East.
  • Advanced A language model for text where the context decides, such as health information between the lines. It sends the page text to gpt-4o in Azure OpenAI, run by Microsoft in Norway East and reachable only from our private network. Fast and Standard send text nowhere outside our servers.

GET /help/engines says which engines this installation runs and whether Advanced and AI search are available.

The 59 categories

This table is generated from the pinned taxonomy file, so it is the list the service uses. An id is never renamed, removed or reused. The tier groups the list for display; engines are routed per category, not per tier.

59 categories, taxonomy version 1.1.0. Showing 59.

idLabelTierFamilyGDPRPattern rule
BANK_ACCOUNTBankkontonummerAnumberIdyes
CASE_NUMBERSaksnummerAnumberId
CREDIT_CARDBetalingskortnummerAnumberIdyes
CRYPTOKryptolommebokAnumberId
DATE_OF_BIRTHFødselsdatoAnumberIdyes
DEVICE_IDEnhets-IDAnumberId
DRIVER_LICENSEFørerkortnummerAnumberId
EMAILE-postadresseAcontactyes
FAX_NUMBERTelefaksnummerAcontact
FIREARMS_LICENSEVåpenkortAnumberId
IBANIBANAnumberId
IDENTITY_CARDID-kortnummerAnumberId
INSURANCE_NUMBERForsikringsnummerAnumberIdyes
IP_ADDRESSIP-adresseAcontactyes
LICENSE_PLATERegistreringsnummerAvehiclePlate
MEDICAL_LICENSEHelsepersonellnummerAnumberId
MILITARY_IDMilitær IDAnumberId
NATIONAL_IDFødselsnummer og andre nasjonale ID-numreAnumberIdyes
ORG_NUMBEROrganisasjonsnummerAnumberIdyes
PASSPORTPassnummerAnumberId
PASSWORDPassordAnumberId
PHONETelefonnummerAcontactyes
POSTAL_CODEPostnummerAplace
SOCIAL_MEDIABrukernavn i sosiale medierAcontactyes
STUDENT_IDStudentnummerAnumberIdyes
TAX_IDSkatte-IDAnumberId
URLNettadresseAcontactyes
USERNAMEBrukernavnAcontact
VESSEL_REGISTRATIONSkipsregistreringAvehiclePlate
VISA_NUMBERVisumnummerAnumberId
ACADEMIC_RECORDSkole- og studieopplysningerBperson
ADDRESSAdresseBplace
AGEAlderBperson
ANIMAL_INFOOpplysninger om dyrBperson
DATE_TIMEDato og tidspunktBnumberId
EMPLOYMENTArbeidsforholdBperson
FAMILY_RELATIONFamilierelasjonBperson
GENDERKjønnBperson
LOCATIONStedBplace
MARITAL_STATUSSivilstatusBperson
NATIONALITYNasjonalitetBperson
ORGANIZATIONOrganisasjonBorganisation
PERSONPersonBperson
AGE_INFOOpplysninger om alderCperson
BEHAVIORAL_PATTERNAtferdsmønsterCperson
BIOMETRIC_DATABiometriske dataCpersonArt. 9
CRIMINALStraffbare forholdCpersonArt. 10
DISABILITYFunksjonsnedsettelseCpersonArt. 9
ECONOMIC_STATUSØkonomisk situasjonCperson
ETHNICITYEtnisk opprinnelseCpersonArt. 9
FINANCIALØkonomiske opplysningerCperson
GENETIC_DATAGenetiske dataCpersonArt. 9
HEALTHHelseCpersonArt. 9
IMMIGRATION_STATUSOppholdsstatusCperson
MEDICATIONLegemidlerCpersonArt. 9
POLITICALPolitisk synCpersonArt. 9
RELIGIOUS_BELIEFReligion og livssynCpersonArt. 9
SEXUAL_ORIENTATIONSeksuell orienteringCpersonArt. 9
TRADE_UNIONFagforeningsmedlemskapCpersonArt. 9

Routing and quality hints

When more than one engine is on, the service looks up which engines read each category in a routing table built from measurements. Every answer says which table it used:

  • coverage.routing_table_version names the table. A deploy in the middle of a large document can mix two tables; then coverage.routing_table_versions lists them and coverage.mixed_routing_tables is true.
  • coverage.provisional lists the requested categories whose routing rests on thin evidence. Treat their quality as less certain than the rest.
  • GET /help/text-categories returns every category with a quality hint per set of engines, for building a picker. A hint is null (no warning), weak (the engines measured weakly on this category), gap (no engine in the set has a label, so the category would be not checked) or no_evidence.

Per-category status: what to do with not_checked

Every file answers with coverage. coverage.status lists only exceptions: a requested category with no entry was read on every page by every engine its route chose.

coverage
"coverage": {
  "taxonomy_version": "1.1.0",
  "routing_table_version": "2026-11-07.3",
  "categories": ["HEALTH", "NATIONAL_ID", "PERSON"],
  "engines_on": ["fast", "standard"],
  "floors": { "fast": null, "standard": 0.5 },
  "provisional": ["HEALTH", "NATIONAL_ID", "PERSON"],
  "unsupported_names": [],
  "status": [
    { "category": "HEALTH", "pages": [3], "status": "not_checked",
      "read_by": [], "missed": ["fast"], "reason": "engine_failed" }
  ]
}
  • degraded: at least one engine read the category on those pages, but not every engine the route chose. The findings are real; there may be fewer than a full run would give.
  • not_checked: no engine read the category on those pages. Treat the text there as unreviewed, never as clean. Retry the request, switch on another engine, or review the pages by hand before you rely on the result. pages: null means the whole file, for example reason: "no_engine_has_label" when none of the engines you switched on has a label for the category.
  • A file that could not be checked at all is "status": "error" with no results. On a stream a failure is an error event, never a stream that just ends.

The threshold

threshold is still accepted and range-checked, on the old routes too, but it no longer removes a finding. Each engine has a fixed floor that we measured: Standard 0.5, Fast none, Advanced 0.5 until it is measured. The answer lists the floors it used in coverage.floors. A request that sends no threshold and one that sends 0.8 give the same answer.

  • If you sent 0.8 or another value above 0.5: findings under your threshold are no longer hidden. You get every finding above the engine's floor, so expect more boxes than before. The extra boxes are over-boxing, never a missed value. Filter on score yourself if you want the old cut.
  • If you sent a value under 0.5: Standard and Advanced findings that score under their floor of 0.5 are no longer returned, however low the threshold. A value that a pattern rule finds keeps its rule box whatever the engine scored.

The rules run for every engine

The 12 pattern rules (identity numbers, account numbers, e-mail, phone, web addresses and the like) run whichever engines are on, so a request for Advanced alone also gets what they find.

The old names

Old names are aliases. A name from the old lists selects the same categories as before, and an old name that stood for two types still selects both. On the new routes the answer says which old names a request used in coverage.aliases_used. The old routes keep their answer shape. The routes /detect/fast, /detect/standard, /detect/advanced, /batch/detect, /batch/multi_detect and /help/entities, and /text/detect when it is sent the old fields, answer with Deprecation: true and a Link header (rel="deprecation") to the changelog below. Any route that is sent an old name also answers with X-Deprecated-Names, never on an encrypted request. A Sunset header will be added once the removal date is set. The removal date is to be announced.

The alias table

Group names

ALLAll categories
ALL_STANDARDAll categories
ALL_ADVANCEDAll categories
ALL_GEMINIAll categories
ALL_FASTThe categories the old Fast list reached

Old names

Every category also answers to the form {id}_S, where id is the category id. The names below are the other old names.

Old nameMeansA request also selectsOld results
NO_BANK_ACCOUNT_FBANK_ACCOUNT
bank account numberBANK_ACCOUNT
BANK_ACCOUNT_ABANK_ACCOUNT
CASE_NUMBER_SCASE_NUMBER
CASE_NUMBER_ACASE_NUMBER
credit card numberCREDIT_CARD
CREDIT_CARD_ACREDIT_CARD
CRYPTO_FCRYPTO
crypto walletCRYPTO
CRYPTO_ACRYPTO
date of birthDATE_OF_BIRTHDATE_TIME
DATE_OF_BIRTH_ADATE_OF_BIRTH
device idDEVICE_ID
DEVICE_ID_ADEVICE_ID
driver license numberDRIVER_LICENSE
DRIVER_LICENSE_ADRIVER_LICENSE
EMAIL_ADDRESS_FEMAIL
EMAIL_ADDRESS_SEMAIL
EMAIL_AEMAIL
fax numberFAX_NUMBER
FAX_NUMBER_AFAX_NUMBER
IBAN_CODE_FIBAN
ibanIBAN
IBAN_AIBAN
identity card numberIDENTITY_CARD
IDENTITY_CARD_AIDENTITY_CARD
insurance numberINSURANCE_NUMBER
INSURANCE_NUMBER_AINSURANCE_NUMBER
IP_ADDRESS_FIP_ADDRESS
ip addressIP_ADDRESS
IP_ADDRESS_AIP_ADDRESS
NO_LICENSE_PLATE_FLICENSE_PLATEVESSEL_REGISTRATIONMay also have been another category
license plate numberLICENSE_PLATEVESSEL_REGISTRATIONMay also have been another category
vehicle registration numberLICENSE_PLATEVESSEL_REGISTRATIONMay also have been another category
registration numberLICENSE_PLATEVESSEL_REGISTRATIONMay also have been another category
LICENSE_PLATE_ALICENSE_PLATE
VEHICLE_REG_ALICENSE_PLATE
MEDICAL_LICENSE_FMEDICAL_LICENSE
military idMILITARY_ID
MILITARY_ID_AMILITARY_ID
NO_FODSELSNUMMER_FNATIONAL_ID
GOV_ID_SNATIONAL_ID
national id numberNATIONAL_ID
NATIONAL_ID_ANATIONAL_IDPASSPORT, DRIVER_LICENSE
GOV_ID_ANATIONAL_IDORG_NUMBER, PASSPORT, DRIVER_LICENSE, IDENTITY_CARD
NO_COMPANY_NUMBER_FORG_NUMBER
organization numberORG_NUMBER
ORG_NUMBER_AORG_NUMBER
passport numberPASSPORT
PASSPORT_APASSPORT
passwordPASSWORD
PASSWORD_APASSWORD
NO_PHONE_NUMBER_FPHONE
NO_PHONE_NUMBER_SPHONE
PHONE_APHONE
POSTAL_CODE_SPOSTAL_CODEADDRESS
postal codePOSTAL_CODEADDRESS
POSTAL_CODE_APOSTAL_CODE
social media handleSOCIAL_MEDIA
SOCIAL_MEDIA_ASOCIAL_MEDIA
student id numberSTUDENT_ID
STUDENT_ID_ASTUDENT_ID
tax identification numberTAX_ID
TAX_ID_ATAX_ID
URL_FURL
urlURL
URL_AURL
usernameUSERNAME
USERNAME_AUSERNAME
visa numberVISA_NUMBER
VISA_NUMBER_AVISA_NUMBER
ACADEMIC_RECORD_SACADEMIC_RECORD
ACADEMIC_RECORD_AACADEMIC_RECORD
NO_ADDRESS_FADDRESSPOSTAL_CODEMay also have been another category
NO_ADDRESS_SADDRESSPOSTAL_CODE
addressADDRESSPOSTAL_CODE
ADDRESS_AADDRESS
AGE_SAGE
AGE_AAGE
ANIMAL_INFO_SANIMAL_INFO
ANIMAL_INFO_AANIMAL_INFO
DATE_TIME_FDATE_TIMEDATE_OF_BIRTHMay also have been another category
DATE_TIME_SDATE_TIMEDATE_OF_BIRTH
dateDATE_TIMEDATE_OF_BIRTH
credit card expiration dateDATE_TIMECREDIT_CARDMay also have been another category
DATE_ADATE_TIME
EMPLOYMENT_INFO_FEMPLOYMENT
EMPLOYMENT_INFO_SEMPLOYMENT
EMPLOYMENT_AEMPLOYMENT
FAMILY_RELATION_FFAMILY_RELATION
FAMILY_RELATION_SFAMILY_RELATION
FAMILY_AFAMILY_RELATION
GENDER_SGENDER
GENDER_AGENDER
LOCATION_FLOCATION
locationLOCATION
LOCATION_ALOCATION
MARITAL_STATUS_SMARITAL_STATUS
MARITAL_STATUS_AMARITAL_STATUS
NATIONALITY_SNATIONALITY
NATIONALITY_ANATIONALITY
ORGANIZATION_FORGANIZATION
organizationORGANIZATION
ORGANIZATION_AORGANIZATION
PERSON_FPERSON
PERSON_SPERSON
PERSON_APERSON
AGE_INFO_SAGE_INFO
AGE_INFO_AAGE_INFO
BEHAVIORAL_PATTERN_SBEHAVIORAL_PATTERN
BEHAVIORAL_PATTERN_ABEHAVIORAL_PATTERN
BIOMETRIC_DATA_SBIOMETRIC_DATA
BIOMETRIC_DATA_ABIOMETRIC_DATA
CRIMINAL_RECORD_FCRIMINAL
CRIMINAL_RECORD_SCRIMINAL
CRIMINAL_ACRIMINAL
DISABILITY_SDISABILITY
DISABILITY_ADISABILITY
ECONOMIC_STATUS_SECONOMIC_STATUS
ECONOMIC_STATUS_AECONOMIC_STATUS
ETHNICITY_SETHNICITY
ETHNICITY_AETHNICITY
FINANCIAL_INFO_FFINANCIAL
FINANCIAL_INFO_SFINANCIAL
FINANCIAL_INFO_AFINANCIAL
GENETIC_DATA_SGENETIC_DATA
GENETIC_DATA_AGENETIC_DATA
HEALTH_INFO_FHEALTHMEDICATIONMay also have been another category
HEALTH_INFO_SHEALTHMEDICATION
medical conditionHEALTHMEDICATION
HEALTH_AHEALTH
MEDICAL_CONDITION_AHEALTH
IMMIGRATION_STATUS_SIMMIGRATION_STATUS
IMMIGRATION_STATUS_AIMMIGRATION_STATUS
medicationMEDICATIONHEALTH
MEDICATION_AMEDICATION
POLITICAL_CASE_FPOLITICAL
POLITICAL_CASE_SPOLITICAL
POLITICAL_AFFILIATION_APOLITICAL
RELIGIOUS_BELIEF_SRELIGIOUS_BELIEF
RELIGIOUS_BELIEF_ARELIGIOUS_BELIEF
SEXUAL_ORIENTATION_FSEXUAL_ORIENTATION
SEXUAL_ORIENTATION_SSEXUAL_ORIENTATION
SEXUAL_ASEXUAL_ORIENTATION
TRADE_UNION_STRADE_UNION
TRADE_UNION_ATRADE_UNION

Names that select nothing

These names have no category in the list. A request that uses them selects nothing for them; a new route lists them in coverage.unsupported_names.

CONTEXT_SENSITIVE_F, CONTEXT_SENSITIVE_S, CONTEXT_A, IDENTIFIABLE_IMAGE_F, IDENTIFIABLE_IMAGE_S, MISC_F

Billing

Billing is per page, and the price does not depend on the engines.

  • What goes unbilled. A page is left out only when it holds a requested category that is not_checked, was read by no engine (read_by is empty) and has a reason on our side: engine_failed, timed_out, deadline, rate_limited or model_unavailable. Then X-Pages-Billed is less than X-Pages-Processed.
  • What is billed. Reasons the request or the document can cause: no_engine_has_label, refused, answer_unreadable and answer_cut_off. So is any reason not listed here, and a degraded page.
  • The cap. At most 50 % of a request's pages go unbilled, rounded down, so a one-page request is always billed.
  • A repeat is not charged again. The same request in the same billing period is charged once: the same user, organisation, file contents, categories, engines, remove_words and text, billing the same number of pages. X-Usage-Charge then says already_charged. A repeat that bills a different number of pages is a new charge. The next billing period charges again.
  • Only the pages you select. With pages, only the selected pages that were read are billed. Another selection is another request.

Sladding

En sladding tar filen og en redaction mapping, listen over hva som skal fjernes, side for side. Bruk listen en deteksjon svarte med, etter at du har gått gjennom den.

  • En PDF sladdes ved bbox for hvert funn. Alle andre formater sladdes der original_text står, hver gang den står der, så send text=true når du finner.
  • En side ingen kunne lese, kan fjernes i sin helhet: {"page": 3, "redact_whole_unit": true, "reason": "not_checked"}.
  • Etter listen din fjerner en mønsterkontroll også fødselsnumre, kontonumre, e-postadresser og telefonnumre blant kategoriene i requested_entities (alle fire når feltet mangler).
  • Alt som sladdes, kontrolleres før det leveres. POST /redact, /pdf/redact og /text/redact svarer 422 BUSINESS_LOGIC_REDACTION_VERIFICATION_FAILED og leverer ingenting når kontrollen feiler; POST /batch/redact holder filen utenfor ZIP-en og oppgir den i batch_summary.json.
  • redaction_appearance bestemmer hvordan sladdingen ser ut i en PDF (fylt felt, tekst, kryss). Teksten fjernes fra filen uansett, også det skjulte tekstlaget.
curl -X POST https://api.declassifai.com/redact \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@report.docx" \
  -F 'redaction_mapping={"pages":[{"page":1,"sensitive":[{"original_text":"Kari Nordmann","category":"PERSON"}]}]}'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("report.docx", "rb"))]
data = {
    "redaction_mapping": "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\"}]}]}",
}

response = requests.post("https://api.declassifai.com/redact", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
content = response.content  # the file
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("report.docx"), "report.docx");
body.append("redaction_mapping", "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\"}]}]}");
const response = await fetch("https://api.declassifai.com/redact", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
const file = await response.arrayBuffer();

Referanse for rutene

Alle offentlige ruter, med felt, svar og et eksempel i curl, Python og JavaScript.

Text detection

Find personal information with one list of 59 categories. You choose the categories and which engines (Fast, Standard, Advanced) read them.

POST/batch/text

Detect in files

  • Nøkkel
  • multipart/form-data

Find personal information in up to 10 files with one list of categories. A request names categories (category ids, or ALL) and engines (one to three of fast, standard, advanced; there is no default). Each finding carries one category, the engines that found it and a score. Each file carries a per-category status in coverage: a category that was not read is listed as degraded or not_checked, never left out or shown as clean. The pattern rules run for every engine.

Felt
  • streamboolean · queryvalgfri

    Answer as Server-Sent Events: file_started, page_completed, file_completed (with the file's coverage), batch_completed. A failure is an error event, never a stream that just ends.

    standard false
  • filesfile[]påkrevd

    Files to read, at most 10 (more is refused with a 4xx that names the limit): PDF (scanned too), DOCX, PPTX, XLSX, CSV, JSON, TXT, MD, HTML and EML. Send the field once per file.

  • categoriesarraypåkrevd

    JSON array of category ids, or ["ALL"] for all 59. Old names are accepted as aliases. A list that selects nothing is refused with 422, never answered as "nothing found".

  • enginesarraypåkrevd

    JSON array of one to three of "fast", "standard", "advanced". There is no default, so you never get an engine you did not choose. An engine this installation does not run is refused with 422.

  • pagesstringvalgfri

    JSON object from file name to the 1-based pages to read, for example {"letter.pdf": [2, 4]}. A file with no entry is read whole. Only the selected pages are answered and billed. A page the file does not have is a 422.

  • remove_wordsstringvalgfri

    Words to leave out of the result

  • thresholdnumbervalgfri

    Accepted and range-checked (0.0 to 1.0). It never removes a finding: each engine has a fixed floor, listed in coverage.floors.

  • textbooleanvalgfri

    Return the text of each finding in original_text. Send true when you will redact a format other than PDF: those redactions find the text by it.

    standard false
  • ocr_wordsbooleanvalgfri

    Return the OCR words of scanned PDF pages on the pages of redaction_mapping. Not with stream=true.

    standard false
Svar
  • 200

    batch_summary and file_results. Check coverage.status of every file: not_checked means the category was not checked on those pages and the text there is unreviewed. A file that could not be checked is status "error" with no results.

    X-Batch-ID
    The id of this batch
    X-Batch-Total-Files
    Files in the request
    X-Batch-Successful-Files
    Files that were checked
    X-Batch-Failed-Files
    Files that could not be checked
    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Operation-ID
    The id of this operation, for support
    X-Deprecated-Names
    The old category names the request used, when it used any
  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

  • 422

    The list of categories selects nothing, an engine is not run by this installation, pages names a page the file does not have, two uploads share a file name while pages is sent, or the detection service refused the request. Nothing is charged.

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

  • 503

    The text routes are not ready. Retry shortly. Nothing is charged.

Three categories, Fast and Standard

curl -X POST https://api.declassifai.com/batch/text \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@letter.pdf" \
  -F 'categories=["PERSON", "NATIONAL_ID", "HEALTH"]' \
  -F 'engines=["fast", "standard"]' \
  -F 'text=true'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("files", open("letter.pdf", "rb"))]
data = {
    "categories": "[\"PERSON\", \"NATIONAL_ID\", \"HEALTH\"]",
    "engines": "[\"fast\", \"standard\"]",
    "text": "true",
}

response = requests.post("https://api.declassifai.com/batch/text", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("files", await openAsBlob("letter.pdf"), "letter.pdf");
body.append("categories", "[\"PERSON\", \"NATIONAL_ID\", \"HEALTH\"]");
body.append("engines", "[\"fast\", \"standard\"]");
body.append("text", "true");
const response = await fetch("https://api.declassifai.com/batch/text", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "text_abc123",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 1.4
  },
  "file_results": [
    {
      "file": "letter.pdf",
      "status": "success",
      "results": {
        "redaction_mapping": {
          "pages": [
            {
              "page": 1,
              "sensitive": [
                {
                  "original_text": "Kari Nordmann",
                  "category": "PERSON",
                  "entity_type": "PERSON",
                  "engines": [
                    "fast",
                    "standard"
                  ],
                  "score": 0.91,
                  "engine_scores": {
                    "fast": 1,
                    "standard": 0.91
                  },
                  "start": 112,
                  "end": 125,
                  "bbox": {
                    "x0": 72,
                    "y0": 640.2,
                    "x1": 148.5,
                    "y1": 652
                  }
                }
              ]
            }
          ]
        },
        "entities_detected": {
          "total": 1,
          "by_category": {
            "PERSON": 1
          },
          "by_page": {
            "1": 1
          }
        },
        "coverage": {
          "taxonomy_version": "1.1.0",
          "routing_table_version": "2026-11-07.3",
          "categories": [
            "HEALTH",
            "PERSON"
          ],
          "engines_on": [
            "fast",
            "standard"
          ],
          "floors": {
            "fast": null,
            "standard": 0.5
          },
          "provisional": [
            "HEALTH",
            "PERSON"
          ],
          "unsupported_names": [],
          "status": [
            {
              "category": "HEALTH",
              "pages": [
                3
              ],
              "status": "not_checked",
              "read_by": [],
              "missed": [
                "fast"
              ],
              "reason": "engine_failed"
            }
          ]
        },
        "model_info": {
          "engines": [
            {
              "engine": "fast",
              "model": "tagger",
              "floor": null
            }
          ]
        },
        "performance": {}
      }
    }
  ]
}
POST/text/detect

Detect in a text string

  • Nøkkel
  • multipart/form-data

Find personal information in a text string (at most 1 MB). With categories and engines (send both, as for /batch/text) it answers the file object of /batch/text, with coverage, and the text of every finding. With the old engine and requested_entities fields it answers the old shape and is deprecated. It needs an active plan, checks the quota first and counts pages as /batch/text does. A text that could not be checked is an error, never an empty success.

Felt
  • textstringpåkrevd

    The text to read (at most 1 MB)

  • categoriesarrayvalgfri

    JSON array of category ids, or ["ALL"]. Send together with engines

  • enginesarrayvalgfri

    JSON array of one to three of "fast", "standard", "advanced". Send together with categories

  • requested_entitiesarrayvalgfri

    Deprecated: use categories. Category ids or old names

  • enginestringvalgfri

    Deprecated: use engines. One of fast, standard, advanced (engine=standard is engines=["standard"])

    standard fast
  • remove_wordsstringvalgfri

    Words to leave out of the result

  • thresholdnumbervalgfri

    Accepted and range-checked (0.0 to 1.0). It removes nothing

Svar
  • 200

    The file object of /batch/text, with coverage. Its redaction_mapping can be sent to /text/redact.

    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Operation-ID
    The id of this operation, for support
  • 400

    The text is over 1 MB

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

  • 422

    The list of categories selects nothing, an engine is not run by this installation, pages names a page the file does not have, two uploads share a file name while pages is sent, or the detection service refused the request. Nothing is charged.

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

  • 503

    The text routes are not ready. Retry shortly. Nothing is charged.

Detect in pasted text

curl -X POST https://api.declassifai.com/text/detect \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F 'text=Brev til Kari Nordmann, kari@example.no' \
  -F 'categories=["PERSON", "EMAIL"]' \
  -F 'engines=["fast"]'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
data = {
    "text": "Brev til Kari Nordmann, kari@example.no",
    "categories": "[\"PERSON\", \"EMAIL\"]",
    "engines": "[\"fast\"]",
}

response = requests.post("https://api.declassifai.com/text/detect", headers=headers, data=data, timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("text", "Brev til Kari Nordmann, kari@example.no");
body.append("categories", "[\"PERSON\", \"EMAIL\"]");
body.append("engines", "[\"fast\"]");
const response = await fetch("https://api.declassifai.com/text/detect", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "file": "bare-text",
  "status": "success",
  "results": {
    "redaction_mapping": {
      "pages": [
        {
          "page": 1,
          "sensitive": [
            {
              "original_text": "Kari Nordmann",
              "category": "PERSON",
              "entity_type": "PERSON",
              "engines": [
                "fast",
                "standard"
              ],
              "score": 0.91,
              "engine_scores": {
                "fast": 1,
                "standard": 0.91
              },
              "start": 112,
              "end": 125,
              "bbox": {
                "x0": 72,
                "y0": 640.2,
                "x1": 148.5,
                "y1": 652
              }
            }
          ]
        }
      ]
    },
    "entities_detected": {
      "total": 1,
      "by_category": {
        "PERSON": 1
      },
      "by_page": {
        "1": 1
      }
    },
    "coverage": {
      "taxonomy_version": "1.1.0",
      "routing_table_version": "2026-11-07.3",
      "categories": [
        "HEALTH",
        "PERSON"
      ],
      "engines_on": [
        "fast",
        "standard"
      ],
      "floors": {
        "fast": null,
        "standard": 0.5
      },
      "provisional": [
        "HEALTH",
        "PERSON"
      ],
      "unsupported_names": [],
      "status": [
        {
          "category": "HEALTH",
          "pages": [
            3
          ],
          "status": "not_checked",
          "read_by": [],
          "missed": [
            "fast"
          ],
          "reason": "engine_failed"
        }
      ]
    },
    "model_info": {
      "engines": [
        {
          "engine": "fast",
          "model": "tagger",
          "floor": null
        }
      ]
    },
    "performance": {}
  }
}

Search, extract and redact

Find words, read text with positions, and redact: one file, up to 10 files as a ZIP, or a text string. Size limits per file: PDF, Office, CSV and EML 50 MB; TXT, MD and HTML 20 MB; JSON 10 MB; a text string 1 MB.

POST/batch/search

Search in files

  • Nøkkel
  • multipart/form-data

Find words or phrases in up to 10 files and get back where they are. Plain search needs only a key and counts no pages. With ai_search=true you describe what to find in your own words; that needs an active plan and counts pages.

Felt
  • filesfile[]påkrevd

    Files to search (PDF, DOCX, PPTX, XLSX, CSV, JSON, TXT, MD, HTML or EML)

  • search_termsstringpåkrevd

    The words to find, separated by spaces; with ai_search, a description of what to find

  • case_sensitivebooleanvalgfri

    Match upper and lower case exactly

    standard false
  • ai_searchbooleanvalgfri

    Search by meaning instead of by the words (counts pages; answers 409 where the installation does not offer it)

    standard false
Svar
  • 200

    batch_summary and file_results. Each file lists its matches by page in results.match_details.pages. A page that could not be searched is listed in results.coverage, so "no match" never stands for "not read".

    X-AI-Search
    true or false
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Operation-ID
    The id of this operation, for support
  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

Find a name

curl -X POST https://api.declassifai.com/batch/search \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@letter.pdf" \
  -F 'search_terms=Kari Nordmann'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("files", open("letter.pdf", "rb"))]
data = {
    "search_terms": "Kari Nordmann",
}

response = requests.post("https://api.declassifai.com/batch/search", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("files", await openAsBlob("letter.pdf"), "letter.pdf");
body.append("search_terms", "Kari Nordmann");
const response = await fetch("https://api.declassifai.com/batch/search", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "search_abc123",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 0.13,
    "search_terms": [
      "Kari",
      "Nordmann"
    ],
    "total_matches": 2,
    "files_with_matches": 1,
    "search_type": "text",
    "case_sensitive": false
  },
  "file_results": [
    {
      "file": "letter.pdf",
      "status": "success",
      "results": {
        "search_terms": "Kari Nordmann",
        "total_matches": 2,
        "match_details": {
          "pages": [
            {
              "page": 1,
              "matches": [
                {
                  "bbox": {
                    "x0": 72,
                    "y0": 640.2,
                    "x1": 101.3,
                    "y1": 652
                  }
                }
              ]
            }
          ]
        }
      }
    }
  ]
}
POST/batch/find_words

Find words in a region

  • Nøkkel
  • multipart/form-data

Give a rectangle and get the words inside it, each once with its box (mode=region, the default), or every occurrence in the files of the text under it (mode=same_text). Needs a key; counts no pages. For formats other than PDF the boxes are synthetic.

Felt
  • filesfile[]påkrevd

    Files to read (PDF, DOCX, PPTX, XLSX, CSV, JSON, TXT, MD, HTML or EML)

  • bounding_boxstringpåkrevd

    JSON object with x0, y0, x1, y1 in PDF points

  • modestringvalgfri

    "region": the words whose boxes lie at least half inside the rectangle, each once. "same_text": the text under the rectangle, then every occurrence of it in the files.

    standard region
Svar
  • 200

    batch_summary and file_results; each file lists its matches by page

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

Every place the text under a box occurs

curl -X POST https://api.declassifai.com/batch/find_words \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@letter.pdf" \
  -F 'bounding_box={"x0": 70, "y0": 638, "x1": 150, "y1": 654}' \
  -F 'mode=same_text'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("files", open("letter.pdf", "rb"))]
data = {
    "bounding_box": "{\"x0\": 70, \"y0\": 638, \"x1\": 150, \"y1\": 654}",
    "mode": "same_text",
}

response = requests.post("https://api.declassifai.com/batch/find_words", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("files", await openAsBlob("letter.pdf"), "letter.pdf");
body.append("bounding_box", "{\"x0\": 70, \"y0\": 638, \"x1\": 150, \"y1\": 654}");
body.append("mode", "same_text");
const response = await fetch("https://api.declassifai.com/batch/find_words", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "batch_find_words_1763283600",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 0.02,
    "total_matches": 2
  },
  "file_results": [
    {
      "file": "letter.pdf",
      "status": "success",
      "results": {
        "pages": [
          {
            "page": 1,
            "matches": [
              {
                "bbox": {
                  "x0": 72,
                  "y0": 640.2,
                  "x1": 101.3,
                  "y1": 652
                }
              },
              {
                "bbox": {
                  "x0": 104.1,
                  "y0": 640.2,
                  "x1": 148.5,
                  "y1": 652
                }
              }
            ]
          }
        ],
        "match_count": 2
      }
    }
  ]
}
POST/extract

Extract text and positions

  • Nøkkel
  • multipart/form-data

Read the text of one file, word by word with boxes. results.bbox_kind is pdf_points for a PDF (real coordinates) and synthetic_grid for other formats (placeholder boxes: draw no overlay from them). With text=true each page also carries text, the exact string the detection engines read, so start and end offsets of findings point into it. Needs a key; counts no pages.

Felt
  • filefilepåkrevd

    The file to read (PDF, DOCX, PPTX, XLSX, CSV, JSON, TXT, MD, HTML or EML)

  • textbooleanvalgfri

    Return the words and the page text; otherwise every word reads [REDACTED]

    standard false
Svar
  • 200

    batch_summary and one file result

  • 415

    The format is refused: .doc, .xls, .ppt and macro-enabled Office files

  • 413

    The file is over the size limit of its format

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

Extract from a Word document

curl -X POST https://api.declassifai.com/extract \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@report.docx" \
  -F 'text=true'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("report.docx", "rb"))]
data = {
    "text": "true",
}

response = requests.post("https://api.declassifai.com/extract", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("report.docx"), "report.docx");
body.append("text", "true");
const response = await fetch("https://api.declassifai.com/extract", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "multi_extract_1763283600.1",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 0.2
  },
  "file_results": [
    {
      "file": "report.docx",
      "status": "success",
      "results": {
        "pages": [
          {
            "page_number": 1,
            "words": [
              {
                "text": "Kari",
                "bbox": {
                  "x0": 0,
                  "y0": 0,
                  "x1": 4,
                  "y1": 1
                }
              }
            ],
            "text": "Kari Nordmann bor i Bjørkeli kommune."
          }
        ],
        "total_document_pages": 1,
        "file_type": "docx",
        "bbox_kind": "synthetic_grid"
      }
    }
  ]
}
POST/redact

Redact a file

  • Nøkkel
  • multipart/form-data

Redact one file and get it back in its own format. The output is checked before it is returned; if the check fails you get a 422 and no file. Needs an active plan; counts no pages.

Felt
  • filefilepåkrevd

    The file to redact (PDF, DOCX, PPTX, XLSX, CSV, JSON, TXT, MD, HTML or EML)

  • redaction_mappingstringpåkrevd

    JSON: {"pages": [{"page": 1, "sensitive": [...]}]}, the redaction_mapping a detection answered (edit it first if you like). A PDF is redacted at each item's bbox; every other format at every occurrence of its original_text, so detect with text=true. A page marked {"page": 3, "redact_whole_unit": true, "reason": "not_checked"} is redacted whole.

  • remove_imagesbooleanvalgfri

    Remove every image. PDF: image regions are redacted. DOCX, PPTX, XLSX: each picture is replaced by a blank one of the same size; a file whose pictures cannot all be replaced is withheld. Ignored for other formats.

    standard false
  • redaction_appearancestringvalgfri

    PDF only, JSON. mode: fill (default), replace_text, cross_out, transparent, fill_and_text or cross_out_and_text. fill_color: three numbers from 0 to 1, default [1, 1, 1] (white). text and text_color (default [0, 0, 0]). font_name (default helv), font_size (default 11, at least 4), align (0 left, 1 centre, the default, 2 right), cross_out (true or false, default false), padding (0 to 50 points), scale_rect (0.1 to 5). replace_text with no text draws a black box. Any other key is refused.

  • requested_entitiesarrayvalgfri

    The categories the run was about. After your mapping is applied, a pattern pass also redacts national identity numbers, bank account numbers, e-mail addresses and phone numbers among them; without this field, all four.

Svar
  • 200

    The redacted file, in the content type of the one you sent

    X-Redactions-Applied
    Redactions made
    X-Verification-Status
    Always verified: a file that fails the check is never returned
    X-Verification-Reason
    Empty, or scanned_regions for a PDF with scanned pages
    X-Operation-ID
    The id of this operation, for support
    X-File-Type
    pdf, docx, pptx, xlsx, csv, json, txt, markdown, eml or html
  • 415

    The format is refused: .doc, .xls, .ppt and macro-enabled Office files

  • 422

    The mapping is not valid JSON

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

  • 422

    The redacted output failed the check that runs after every redaction (BUSINESS_LOGIC_REDACTION_VERIFICATION_FAILED). No file is returned. details.verification says why. A document that cannot be read (password protected, damaged) is BUSINESS_LOGIC_DOCUMENT_UNREADABLE, also 422, with details.reason.

Redact a Word document

curl -X POST https://api.declassifai.com/redact \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@report.docx" \
  -F 'redaction_mapping={"pages":[{"page":1,"sensitive":[{"original_text":"Kari Nordmann","category":"PERSON"}]}]}'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("report.docx", "rb"))]
data = {
    "redaction_mapping": "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\"}]}]}",
}

response = requests.post("https://api.declassifai.com/redact", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
content = response.content  # the file
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("report.docx"), "report.docx");
body.append("redaction_mapping", "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\"}]}]}");
const response = await fetch("https://api.declassifai.com/redact", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
const file = await response.arrayBuffer();
Svar · 200
The redacted file (binary)
POST/batch/redact

Redact files

  • Nøkkel
  • multipart/form-data

Redact up to 10 files and get one ZIP back, each file in its own format, with batch_summary.json. Every file is checked after it is redacted; a file that fails the check is left out of the ZIP and listed in batch_summary.json (file_verifications, with error_code BUSINESS_LOGIC_REDACTION_VERIFICATION_FAILED). Needs an active plan; counts no pages.

Felt
  • filesfile[]påkrevd

    Files to redact (PDF, DOCX, PPTX, XLSX, CSV, JSON, TXT, MD, HTML or EML), at most 10; more is refused with a 422 that names the limit

  • redaction_mappingsstringpåkrevd

    JSON, one of three shapes: (1) the whole answer of /batch/text as it came ({"file_results": [...]}; files with status "success" are used); (2) an object from file name to its mapping ({"letter.pdf": {"pages": [...]}}, or {"letter.pdf": {"redaction_mapping": {...}}}); (3) one file: {"file_info": {"filename": "letter.pdf"}, "redaction_mapping": {...}}. Names are matched exactly; a name given twice is refused.

  • remove_imagesbooleanvalgfri

    Remove every image. PDF: image regions are redacted. DOCX, PPTX, XLSX: each picture is replaced by a blank one of the same size; a file whose pictures cannot all be replaced is withheld. Ignored for other formats.

    standard false
  • redaction_appearancestringvalgfri

    PDF only, JSON. mode: fill (default), replace_text, cross_out, transparent, fill_and_text or cross_out_and_text. fill_color: three numbers from 0 to 1, default [1, 1, 1] (white). text and text_color (default [0, 0, 0]). font_name (default helv), font_size (default 11, at least 4), align (0 left, 1 centre, the default, 2 right), cross_out (true or false, default false), padding (0 to 50 points), scale_rect (0.1 to 5). replace_text with no text draws a black box. Any other key is refused.

  • requested_entitiesarrayvalgfri

    The categories the run was about. After your mapping is applied, a pattern pass also redacts national identity numbers, bank account numbers, e-mail addresses and phone numbers among them; without this field, all four.

Svar
  • 200

    application/zip: the redacted files that passed the check, and batch_summary.json (counts, file_verifications, file_outcomes for every file by its place in the request)

    X-Batch-ID
    The id of this batch
    X-Successful-Count
    Files redacted and delivered
    X-Failed-Count
    Files not delivered
    X-Verification-Failed-Count
    Files withheld because they failed the check
    X-Total-Redactions
    Redactions made across the files
  • 400

    The mappings are not valid JSON, or name a file twice

  • 422

    Two uploads with the same file name, no mapping that matches an uploaded file, or no file that could be read

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

Redact with the detection answer

curl -X POST https://api.declassifai.com/batch/redact \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@letter.pdf" \
  -F 'redaction_mappings={"letter.pdf":{"pages":[{"page":1,"sensitive":[{"original_text":"Kari Nordmann","category":"PERSON","bbox":{"x0":72,"y0":640.2,"x1":148.5,"y1":652}}]}]}}'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("files", open("letter.pdf", "rb"))]
data = {
    "redaction_mappings": "{\"letter.pdf\":{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\",\"bbox\":{\"x0\":72,\"y0\":640.2,\"x1\":148.5,\"y1\":652}}]}]}}",
}

response = requests.post("https://api.declassifai.com/batch/redact", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
content = response.content  # the file
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("files", await openAsBlob("letter.pdf"), "letter.pdf");
body.append("redaction_mappings", "{\"letter.pdf\":{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\",\"bbox\":{\"x0\":72,\"y0\":640.2,\"x1\":148.5,\"y1\":652}}]}]}}");
const response = await fetch("https://api.declassifai.com/batch/redact", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
const file = await response.arrayBuffer();
Svar · 200
redacted_batch_<batch id>.zip: letter.pdf, batch_summary.json
POST/text/redact

Redact a text string

  • Nøkkel
  • multipart/form-data

Apply a redaction mapping (usually the one /text/detect answered) to a text string. Each finding is replaced by a label such as [PERSON] or [REDACTED]. The result is checked first; if the check fails you get a 422 and no text. Needs an active plan; counts no pages.

Felt
  • textstringpåkrevd

    The text (at most 1 MB)

  • redaction_mappingstringpåkrevd

    JSON redaction mapping (at most 1 MB). Items are found by original_text.

Svar
  • 200

    The redacted text and the result of the check

  • 400

    The text or the mapping is over 1 MB

  • 422

    The text is empty, or the mapping is not valid JSON

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

  • 422

    The redacted output failed the check that runs after every redaction (BUSINESS_LOGIC_REDACTION_VERIFICATION_FAILED). No file is returned. details.verification says why. A document that cannot be read (password protected, damaged) is BUSINESS_LOGIC_DOCUMENT_UNREADABLE, also 422, with details.reason.

Redact pasted text

curl -X POST https://api.declassifai.com/text/redact \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F 'text=Brev til Kari Nordmann, kari@example.no' \
  -F 'redaction_mapping={"pages":[{"page":1,"sensitive":[{"original_text":"Kari Nordmann","entity_type":"PERSON"},{"original_text":"kari@example.no","entity_type":"EMAIL"}]}]}'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
data = {
    "text": "Brev til Kari Nordmann, kari@example.no",
    "redaction_mapping": "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"entity_type\":\"PERSON\"},{\"original_text\":\"kari@example.no\",\"entity_type\":\"EMAIL\"}]}]}",
}

response = requests.post("https://api.declassifai.com/text/redact", headers=headers, data=data, timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("text", "Brev til Kari Nordmann, kari@example.no");
body.append("redaction_mapping", "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"entity_type\":\"PERSON\"},{\"original_text\":\"kari@example.no\",\"entity_type\":\"EMAIL\"}]}]}");
const response = await fetch("https://api.declassifai.com/text/redact", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "redacted_text": "Brev til [PERSON], [REDACTED]",
  "redactions_applied": 2,
  "verification_passed": true,
  "verification_reason": null,
  "operation_id": "text_redact_1763283600.1"
}
POST/pdf/redact

Redact a PDF

  • Nøkkel
  • multipart/form-data

The PDF-only form of POST /redact, with the same fields and the same check: a PDF that fails it is a 422 and is not returned. Returns application/pdf.

Felt
  • filefilepåkrevd

    The PDF to redact

  • redaction_mappingstringpåkrevd

    JSON: {"pages": [{"page": 1, "sensitive": [...]}]}, the redaction_mapping a detection answered (edit it first if you like). A PDF is redacted at each item's bbox; every other format at every occurrence of its original_text, so detect with text=true. A page marked {"page": 3, "redact_whole_unit": true, "reason": "not_checked"} is redacted whole.

  • remove_imagesbooleanvalgfri

    Remove every image. PDF: image regions are redacted. DOCX, PPTX, XLSX: each picture is replaced by a blank one of the same size; a file whose pictures cannot all be replaced is withheld. Ignored for other formats.

    standard false
  • redaction_appearancestringvalgfri

    PDF only, JSON. mode: fill (default), replace_text, cross_out, transparent, fill_and_text or cross_out_and_text. fill_color: three numbers from 0 to 1, default [1, 1, 1] (white). text and text_color (default [0, 0, 0]). font_name (default helv), font_size (default 11, at least 4), align (0 left, 1 centre, the default, 2 right), cross_out (true or false, default false), padding (0 to 50 points), scale_rect (0.1 to 5). replace_text with no text draws a black box. Any other key is refused.

  • requested_entitiesarrayvalgfri

    The categories the run was about. After your mapping is applied, a pattern pass also redacts national identity numbers, bank account numbers, e-mail addresses and phone numbers among them; without this field, all four.

Svar
  • 200

    The redacted PDF

    X-Redactions-Applied
    Redactions made
    X-Verification-Status
    Always verified: a file that fails the check is never returned
    X-Verification-Reason
    Empty, or scanned_regions for a PDF with scanned pages
    X-Operation-ID
    The id of this operation, for support
  • 422

    The mapping is not valid JSON

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

  • 422

    The redacted output failed the check that runs after every redaction (BUSINESS_LOGIC_REDACTION_VERIFICATION_FAILED). No file is returned. details.verification says why. A document that cannot be read (password protected, damaged) is BUSINESS_LOGIC_DOCUMENT_UNREADABLE, also 422, with details.reason.

Redact a PDF

curl -X POST https://api.declassifai.com/pdf/redact \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@letter.pdf" \
  -F 'redaction_mapping={"pages":[{"page":1,"sensitive":[{"original_text":"Kari Nordmann","category":"PERSON","bbox":{"x0":72,"y0":640.2,"x1":148.5,"y1":652}}]}]}'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("letter.pdf", "rb"))]
data = {
    "redaction_mapping": "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\",\"bbox\":{\"x0\":72,\"y0\":640.2,\"x1\":148.5,\"y1\":652}}]}]}",
}

response = requests.post("https://api.declassifai.com/pdf/redact", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
content = response.content  # the file
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("letter.pdf"), "letter.pdf");
body.append("redaction_mapping", "{\"pages\":[{\"page\":1,\"sensitive\":[{\"original_text\":\"Kari Nordmann\",\"category\":\"PERSON\",\"bbox\":{\"x0\":72,\"y0\":640.2,\"x1\":148.5,\"y1\":652}}]}]}");
const response = await fetch("https://api.declassifai.com/pdf/redact", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
const file = await response.arrayBuffer();
Svar · 200
redacted.pdf (binary)
POST/pdf/extract

Extract from a PDF

  • Nøkkel
  • multipart/form-data

The PDF-only form of POST /extract: words with their boxes in PDF points.

Felt
  • filefilepåkrevd

    The PDF to read

  • textbooleanvalgfri

    Return the words and the page text; otherwise every word reads [REDACTED]

    standard false
Svar
  • 200

    batch_summary and one file result, as POST /extract answers

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

Extract from a PDF

curl -X POST https://api.declassifai.com/pdf/extract \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@letter.pdf" \
  -F 'text=true'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("letter.pdf", "rb"))]
data = {
    "text": "true",
}

response = requests.post("https://api.declassifai.com/pdf/extract", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("letter.pdf"), "letter.pdf");
body.append("text", "true");
const response = await fetch("https://api.declassifai.com/pdf/extract", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "file_results": [
    {
      "file": "letter.pdf",
      "status": "success",
      "results": {
        "pages": [
          {
            "page_number": 1,
            "words": [
              {
                "text": "Kari",
                "bbox": {
                  "x0": 72,
                  "y0": 640.2,
                  "x1": 101.3,
                  "y1": 652
                }
              }
            ]
          }
        ],
        "total_document_pages": 1
      }
    }
  ]
}

Photos

Faces, people and other things in photos, and personal information in the text of a photo: upload, detect, redact, fetch, delete. JSON bodies; refusals in the usual error shape.

POST/images

Upload a photo

  • Nøkkel
  • multipart/form-data

Store one JPEG, PNG or WebP photo (at most 50 MB) and get the id the other photo routes ask by. A photo is deleted within 2 hours of upload; DELETE /images/{image_id} removes it at once.

Felt
  • filefilepåkrevd

    The photo: JPEG, PNG or WebP

Svar
  • 201

    Stored

  • 413

    The photo is over 50 MB

  • 415

    Not a JPEG, PNG or WebP

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 503

    Photo processing is not available on this installation right now

Upload

curl -X POST https://api.declassifai.com/images \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@street.jpg"
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("street.jpg", "rb"))]

response = requests.post("https://api.declassifai.com/images", headers=headers, files=files, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("street.jpg"), "street.jpg");
const response = await fetch("https://api.declassifai.com/images", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 201
{
  "image_id": "3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b",
  "size_bytes": 482113,
  "format": "jpeg"
}
POST/images/{image_id}/detect

Find what to redact in a photo

  • Nøkkel
  • application/json

One answer with the regions the visual models found and the regions found in the text of the photo, in the photo's own oriented pixels. You name what the visual models look for (GET /help/visual-types lists what can be asked for); an empty selection is refused and never means everything. A detector that fails is a partial failure with an id, and the redaction must acknowledge each one.

Felt
  • image_idstring · pathpåkrevd

    The id the upload answered

  • selection.entity_typesarraypåkrevd

    The visual types to look for (ids from GET /help/visual-types, such as visual.FACE), 1 to 64

  • effortstringvalgfri

    standard or thorough

    standard standard
  • textobjectvalgfri

    {"enabled": true, "entities": ["ALL"]}: whether the text in the photo is read for personal information, and for which categories (ids or ALL). It is read with the Standard engine.

Svar
  • 200

    The regions, with detection_id, detection_token and pixel_sha256 to send back with the redaction, and expires_at

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

  • 404

    No photo or output with that id is yours

  • 409

    The photo cannot be detected in its present state

  • 422

    The body is not valid, or a type cannot be asked for here (ENTITY_UNAVAILABLE)

  • 429

    The service is busy; try again shortly

  • 503

    Photo processing is not available on this installation right now

Faces, people and the text in the photo

curl -X POST https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/detect \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "selection": {
    "entity_types": [
      "visual.FACE",
      "visual.PERSON"
    ]
  },
  "effort": "standard",
  "text": {
    "enabled": true,
    "entities": [
      "ALL"
    ]
  }
}'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
body = {
    "selection": {
        "entity_types": [
            "visual.FACE",
            "visual.PERSON",
        ],
    },
    "effort": "standard",
    "text": {
        "enabled": True,
        "entities": [
            "ALL",
        ],
    },
}

response = requests.post("https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/detect", headers=headers, json=body, timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const body = JSON.stringify({
  "selection": {
    "entity_types": [
      "visual.FACE",
      "visual.PERSON"
    ]
  },
  "effort": "standard",
  "text": {
    "enabled": true,
    "entities": [
      "ALL"
    ]
  }
});
const response = await fetch("https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/detect", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY, "Content-Type": "application/json" } });
console.log(response.status, await response.json());
Svar · 200
{
  "image_id": "3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b",
  "detection_id": "5f0c2a4e-8b1d-4c3e-9a7f-2d6b8e0c4a1f",
  "detection_token": "<send back unchanged>",
  "pixel_sha256": "sha256:4b6f0d2c9e8a7b5c3d1e0f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c",
  "coordinate_space": "oriented",
  "width": 1600,
  "height": 1067,
  "regions": [
    {
      "region_id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
      "source": "visual",
      "entity_type": "visual.FACE",
      "confidence": 0.93,
      "selected": true,
      "box": {
        "x0": 412,
        "y0": 188,
        "x1": 498,
        "y1": 290
      }
    }
  ],
  "partial_failures": [],
  "expires_at": "2026-11-16T11:00:00Z"
}
POST/images/{image_id}/redact

Redact a photo

  • Nøkkel
  • application/json

Redact exactly the regions you send: the ones the detection found, changed or not, text regions, and boxes a person drew (source manual). method is solid, pixelate or blur. Refused until every partial failure of the detection is acknowledged by its id and the detection token is sent back unchanged. An empty region list needs confirm_no_regions: true. Fetch the result by its output_id.

Felt
  • image_idstring · pathpåkrevd

    The photo

  • detection_tokenstringpåkrevd

    From the detection, unchanged

  • detection_idstringpåkrevd

    From the detection

  • pixel_sha256stringpåkrevd

    From the detection

  • regionsarraypåkrevd

    Up to 1,000 regions: source (visual, text or manual), box in oriented pixels, method (solid, pixelate, blur), strength 1 to 100

  • confirm_no_regionsbooleanvalgfri

    Say that nothing is to be redacted

    standard false
  • acknowledged_partial_failuresarrayvalgfri

    The failure_id of every partial failure of the detection

  • outputobjectvalgfri

    {"format": "same" | "jpeg" | "png" | "webp", "quality": 1 to 100}

Svar
  • 200

    The redacted photo is ready

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 402

    The key works, but there is no active plan behind it (for example VALIDATION_SUBSCRIPTION_NOT_FOUND).

  • 404

    No photo or output with that id is yours

  • 409

    A partial failure is not acknowledged, or the token does not match the detection

  • 422

    The body is not valid

  • 503

    Photo processing is not available on this installation right now

Blur one face

curl -X POST https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/redact \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "detection_token": "<from the detection>",
  "detection_id": "5f0c2a4e-8b1d-4c3e-9a7f-2d6b8e0c4a1f",
  "pixel_sha256": "sha256:4b6f0d2c9e8a7b5c3d1e0f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c",
  "regions": [
    {
      "source": "visual",
      "region_id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
      "entity_type": "visual.FACE",
      "box": {
        "x0": 412,
        "y0": 188,
        "x1": 498,
        "y1": 290
      },
      "method": "blur"
    }
  ],
  "acknowledged_partial_failures": [],
  "output": {
    "format": "same",
    "quality": 90
  }
}'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
body = {
    "detection_token": "<from the detection>",
    "detection_id": "5f0c2a4e-8b1d-4c3e-9a7f-2d6b8e0c4a1f",
    "pixel_sha256": "sha256:4b6f0d2c9e8a7b5c3d1e0f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c",
    "regions": [
        {
            "source": "visual",
            "region_id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
            "entity_type": "visual.FACE",
            "box": {
                "x0": 412,
                "y0": 188,
                "x1": 498,
                "y1": 290,
            },
            "method": "blur",
        },
    ],
    "acknowledged_partial_failures": [],
    "output": {
        "format": "same",
        "quality": 90,
    },
}

response = requests.post("https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/redact", headers=headers, json=body, timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const body = JSON.stringify({
  "detection_token": "<from the detection>",
  "detection_id": "5f0c2a4e-8b1d-4c3e-9a7f-2d6b8e0c4a1f",
  "pixel_sha256": "sha256:4b6f0d2c9e8a7b5c3d1e0f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c",
  "regions": [
    {
      "source": "visual",
      "region_id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
      "entity_type": "visual.FACE",
      "box": {
        "x0": 412,
        "y0": 188,
        "x1": 498,
        "y1": 290
      },
      "method": "blur"
    }
  ],
  "acknowledged_partial_failures": [],
  "output": {
    "format": "same",
    "quality": 90
  }
});
const response = await fetch("https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/redact", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY, "Content-Type": "application/json" } });
console.log(response.status, await response.json());
Svar · 200
{
  "output_id": "9b8a7c6d5e4f3a2b1c0d9e8f7a6b5c4d",
  "format": "jpeg",
  "width": 1600,
  "height": 1067,
  "output_sha256": "<sha256>",
  "warnings": [],
  "expires_at": "2026-11-16T11:00:00Z"
}
GET/images/outputs/{output_id}

Fetch a redacted photo

  • Nøkkel

Download the redacted photo (image/jpeg, image/png or image/webp).

Felt
  • output_idstring · pathpåkrevd

    From the redaction

Svar
  • 200

    The photo

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 404

    No photo or output with that id is yours

Download

curl -X GET https://api.declassifai.com/images/outputs/9b8a7c6d5e4f3a2b1c0d9e8f7a6b5c4d \
  -H "raw-api-key: $DECLASSIFAI_API_KEY"
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}

response = requests.get("https://api.declassifai.com/images/outputs/9b8a7c6d5e4f3a2b1c0d9e8f7a6b5c4d", headers=headers, timeout=120)
response.raise_for_status()
content = response.content  # the file
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/images/outputs/9b8a7c6d5e4f3a2b1c0d9e8f7a6b5c4d", { method: "GET", headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
const file = await response.arrayBuffer();
Svar · 200
redacted.jpeg (binary)
DELETE/images/{image_id}

Delete a photo

  • Nøkkel

Remove the photo and every detection of it now. Asking again, or about an id that is not yours, gets the same answer. DELETE /images/outputs/{output_id} removes a redacted photo the same way.

Felt
  • image_idstring · pathpåkrevd

    The photo

Svar
  • 200

    Gone

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

Delete

curl -X DELETE https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b \
  -H "raw-api-key: $DECLASSIFAI_API_KEY"
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}

response = requests.delete("https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b", headers=headers, timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/images/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b", { method: "DELETE", headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "deleted": true
}

Status and help

Whether the API is up, which engines this installation runs, and the lists to build a picker from

GET/status

API status

  • Ingen nøkkel

Whether the API and the detection service are up, and the API version. No key needed.

Svar
  • 200

    The status

API status

curl -X GET https://api.declassifai.com/status
import os
import requests


response = requests.get("https://api.declassifai.com/status", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/status", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "status": "success",
  "version": "1.0.0",
  "timestamp": 1763283600.05,
  "services": {
    "central_backend": "online",
    "detection_service": "online"
  },
  "message": "All services operational"
}
GET/health

Health check

  • Ingen nøkkel

Up or down, and the version. No key needed. For the services behind it, read GET /status.

Svar
  • 200

    Up

Health check

curl -X GET https://api.declassifai.com/health
import os
import requests


response = requests.get("https://api.declassifai.com/health", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/health", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "status": "up",
  "version": "1.0.0"
}
GET/help/engines

Engines

  • Ingen nøkkel

The engines this installation runs, under the names requests use (fast, standard, advanced), and whether the features that need the language model (Advanced, AI search) are available here. No key needed.

Svar
  • 200

    The engines

Engines

curl -X GET https://api.declassifai.com/help/engines
import os
import requests


response = requests.get("https://api.declassifai.com/help/engines", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/help/engines", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "engines": [
    "fast",
    "standard",
    "advanced"
  ],
  "availability": {
    "advanced": "available",
    "ai_search": "available"
  },
  "timestamp": 1763283600.05
}
GET/help/text-categories

Text categories

  • Ingen nøkkel

The 59 text categories with a quality hint per set of engines, for building a picker. The hint is keyed by the set of engines: null (no warning), weak (the engines measured weakly on this category), gap (no engine in the set has a label for it, so it would be not checked) or no_evidence. Kept for five minutes; the answer carries ETag and X-Routing-Table-Version. If the list cannot be given the answer is a 503, never an empty list. No key needed.

Svar
  • 200

    Categories with hints

    ETag
    Changes with the taxonomy and routing table
    X-Routing-Table-Version
    The routing table
  • 503

    The list cannot be given right now

Text categories

curl -X GET https://api.declassifai.com/help/text-categories
import os
import requests


response = requests.get("https://api.declassifai.com/help/text-categories", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/help/text-categories", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "taxonomy_version": "1.1.0",
  "routing_table_version": "2026-11-07.3",
  "engines_available": [
    "fast",
    "standard",
    "advanced"
  ],
  "categories": [
    {
      "id": "PERSON",
      "tier": "B",
      "family": "person",
      "provisional": true,
      "hint": {
        "fast": "weak",
        "standard": null,
        "fast+standard": null,
        "advanced": "no_evidence"
      }
    }
  ]
}
GET/help/visual-types

Visual types

  • Nøkkel

What the photo routes can look for here, by profile. selectable is false for a type that cannot be asked for on this installation (not available, or switched off); asking for one is refused with ENTITY_UNAVAILABLE. Needs a key.

Svar
  • 200

    The visual types

  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

Visual types

curl -X GET https://api.declassifai.com/help/visual-types \
  -H "raw-api-key: $DECLASSIFAI_API_KEY"
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}

response = requests.get("https://api.declassifai.com/help/visual-types", headers=headers, timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/help/visual-types", { method: "GET", headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "taxonomy_version": 1,
  "profiles": [
    {
      "domain": "photo",
      "media": "image",
      "entities": [
        {
          "entity_type": "visual.FACE",
          "available": true,
          "enabled": true,
          "selectable": true
        }
      ]
    }
  ]
}
GET/help/routes

Routes

  • Ingen nøkkel

Every public route under routes, grouped (entity_detection, batch_processing, multi_format, images...), read from the API itself. A deprecated route says "deprecated": true. No key needed.

Svar
  • 200

    The routes

Routes

curl -X GET https://api.declassifai.com/help/routes
import os
import requests


response = requests.get("https://api.declassifai.com/help/routes", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/help/routes", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "routes": {
    "batch_processing": [
      {
        "path": "/batch/text",
        "method": "POST",
        "description": "Batch text detection with one category list and the engines as switches."
      }
    ],
    "entity_detection": [
      {
        "path": "/detect/fast",
        "method": "POST",
        "description": "…",
        "deprecated": true
      }
    ]
  },
  "timestamp": 1763283600.05
}
GET/help/detectors-status

Engine status

  • Ingen nøkkel

Whether each engine is loaded and ready. No key needed.

Svar
  • 200

    Per engine

Engine status

curl -X GET https://api.declassifai.com/help/detectors-status
import os
import requests


response = requests.get("https://api.declassifai.com/help/detectors-status", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/help/detectors-status", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "fast": {
    "initialized": true,
    "status": "ready"
  },
  "standard": {
    "initialized": true,
    "status": "ready"
  },
  "advanced": {
    "initialized": true,
    "status": "ready"
  },
  "meta": {
    "detection_service_ready": true,
    "ready_count": 3,
    "total_count": 3,
    "cache_ttl": 60,
    "last_updated": "2026-11-16T09:00:00"
  }
}
GET/help/entities

Old names per engine

  • Ingen nøkkel
  • Utgående

Deprecated: use GET /help/text-categories. The lists of old names per engine. Deprecated: use POST /batch/text. This route keeps working until a removal date, which is to be announced. It answers with the headers Deprecation and Link, and with X-Deprecated-Names when the request used old names. Its threshold no longer removes findings.

Svar
  • 200

    Old names by engine

Old names per engine

curl -X GET https://api.declassifai.com/help/entities
import os
import requests


response = requests.get("https://api.declassifai.com/help/entities", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/help/entities", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "entities": {
    "fast": [
      "<old names the Fast engine answered to>"
    ],
    "standard": [
      "<old names the Standard engine answered to>"
    ],
    "advanced": [
      "<old names the Advanced engine answered to>"
    ]
  }
}
GET/help/entity-examples

Example values

  • Ingen nøkkel

A fixed list of example values for some kinds of personal information, under older names. No key needed.

Svar
  • 200

    Examples

Example values

curl -X GET https://api.declassifai.com/help/entity-examples
import os
import requests


response = requests.get("https://api.declassifai.com/help/entity-examples", timeout=120)
response.raise_for_status()
print(response.json())
// Node 20 or later: run this on your server, where the key is kept.
const response = await fetch("https://api.declassifai.com/help/entity-examples", { method: "GET" });
console.log(response.status, await response.json());
Svar · 200
{
  "examples": [
    {
      "entity": "PERSON",
      "examples": [
        "John Doe",
        "Jane Smith"
      ]
    }
  ],
  "timestamp": 1763283600.05
}

Deprecated detection routes

The routes from before the one category list and the engine switches. They keep working until a removal date, which is to be announced, and answer with deprecation headers. Build on POST /batch/text.

POST/detect/fast

Detect with Fast

  • Nøkkel
  • Utgående
  • multipart/form-data

Deprecated: use POST /batch/text. This route keeps working until a removal date, which is to be announced. It answers with the headers Deprecation and Link, and with X-Deprecated-Names when the request used old names. Its threshold no longer removes findings. Reads one file with the Fast engine.

Felt
  • filefilepåkrevd

    The document to read

  • requested_entitiesarrayvalgfri

    JSON array of category ids or old names. Old names are aliases: each selects the categories it selected before. See the alias table.

    standard ["ALL_FAST"]
  • remove_wordsstringvalgfri

    Words to leave out of the result

  • thresholdnumbervalgfri

    Accepted and range-checked (0.0 to 1.0). It no longer removes findings: each engine has a fixed floor.

  • textbooleanvalgfri

    Include the text of each finding in the response

    standard false
Svar
  • 200

    batch_summary and file_results in the shape this route has always had. Each finding is named in the engine's old name for its category (see the alias table).

    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Operation-ID
    The id of this operation, for support
    Deprecation
    true
    Link
    <…/developers#changelog>; rel="deprecation"
  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

The same request on the new route

curl -X POST https://api.declassifai.com/detect/fast \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@document.pdf" \
  -F 'requested_entities=["PERSON", "EMAIL", "PHONE"]'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("document.pdf", "rb"))]
data = {
    "requested_entities": "[\"PERSON\", \"EMAIL\", \"PHONE\"]",
}

response = requests.post("https://api.declassifai.com/detect/fast", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("document.pdf"), "document.pdf");
body.append("requested_entities", "[\"PERSON\", \"EMAIL\", \"PHONE\"]");
const response = await fetch("https://api.declassifai.com/detect/fast", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "detect_abc123",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 1.2
  },
  "file_results": [
    {
      "file": "document.pdf",
      "status": "success",
      "results": {
        "redaction_mapping": {
          "pages": [
            {
              "page": 1,
              "sensitive": [
                {
                  "engine": "fast",
                  "entity_type": "<the engine's old name for the category>",
                  "start": 0,
                  "end": 13,
                  "score": 0.85,
                  "bbox": {
                    "x0": 70.8,
                    "y0": 789.99,
                    "x1": 131.39,
                    "y1": 795.38
                  }
                }
              ]
            }
          ]
        },
        "entities_detected": {
          "total": 1
        }
      }
    }
  ]
}
POST/detect/standard

Detect with Standard

  • Nøkkel
  • Utgående
  • multipart/form-data

Deprecated: use POST /batch/text. This route keeps working until a removal date, which is to be announced. It answers with the headers Deprecation and Link, and with X-Deprecated-Names when the request used old names. Its threshold no longer removes findings. Reads one file with the Standard engine.

Felt
  • filefilepåkrevd

    The document to read

  • requested_entitiesarrayvalgfri

    JSON array of category ids or old names. Old names are aliases: each selects the categories it selected before. See the alias table.

    standard ["ALL_STANDARD"]
  • remove_wordsstringvalgfri

    Words to leave out of the result

  • thresholdnumbervalgfri

    Accepted and range-checked (0.0 to 1.0). It no longer removes findings: each engine has a fixed floor.

  • textbooleanvalgfri

    Include the text of each finding in the response

    standard false
Svar
  • 200

    batch_summary and file_results in the shape this route has always had. Each finding is named in the engine's old name for its category (see the alias table).

    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Operation-ID
    The id of this operation, for support
    Deprecation
    true
    Link
    <…/developers#changelog>; rel="deprecation"
  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

The same request on the new route

curl -X POST https://api.declassifai.com/detect/standard \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@document.pdf" \
  -F 'requested_entities=["PERSON", "EMAIL", "PHONE"]'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("document.pdf", "rb"))]
data = {
    "requested_entities": "[\"PERSON\", \"EMAIL\", \"PHONE\"]",
}

response = requests.post("https://api.declassifai.com/detect/standard", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("document.pdf"), "document.pdf");
body.append("requested_entities", "[\"PERSON\", \"EMAIL\", \"PHONE\"]");
const response = await fetch("https://api.declassifai.com/detect/standard", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "detect_abc123",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 1.2
  },
  "file_results": [
    {
      "file": "document.pdf",
      "status": "success",
      "results": {
        "redaction_mapping": {
          "pages": [
            {
              "page": 1,
              "sensitive": [
                {
                  "engine": "fast",
                  "entity_type": "<the engine's old name for the category>",
                  "start": 0,
                  "end": 13,
                  "score": 0.85,
                  "bbox": {
                    "x0": 70.8,
                    "y0": 789.99,
                    "x1": 131.39,
                    "y1": 795.38
                  }
                }
              ]
            }
          ]
        },
        "entities_detected": {
          "total": 1
        }
      }
    }
  ]
}
POST/detect/advanced

Detect with Advanced

  • Nøkkel
  • Utgående
  • multipart/form-data

Deprecated: use POST /batch/text. This route keeps working until a removal date, which is to be announced. It answers with the headers Deprecation and Link, and with X-Deprecated-Names when the request used old names. Its threshold no longer removes findings. Reads one file with the Advanced engine, which sends the page text to gpt-4o in Azure OpenAI, run by Microsoft in Norway East.

Felt
  • filefilepåkrevd

    The document to read

  • requested_entitiesarrayvalgfri

    JSON array of category ids or old names. Old names are aliases: each selects the categories it selected before. See the alias table.

    standard ["ALL_ADVANCED"]
  • remove_wordsstringvalgfri

    Words to leave out of the result

  • thresholdnumbervalgfri

    Accepted and range-checked (0.0 to 1.0). It no longer removes findings: each engine has a fixed floor.

  • textbooleanvalgfri

    Include the text of each finding in the response

    standard false
Svar
  • 200

    batch_summary and file_results in the shape this route has always had. Each finding is named in the engine's old name for its category (see the alias table).

    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Operation-ID
    The id of this operation, for support
    Deprecation
    true
    Link
    <…/developers#changelog>; rel="deprecation"
  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

The same request on the new route

curl -X POST https://api.declassifai.com/detect/advanced \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "file=@document.pdf" \
  -F 'requested_entities=["PERSON", "EMAIL", "PHONE"]'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("file", open("document.pdf", "rb"))]
data = {
    "requested_entities": "[\"PERSON\", \"EMAIL\", \"PHONE\"]",
}

response = requests.post("https://api.declassifai.com/detect/advanced", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("file", await openAsBlob("document.pdf"), "document.pdf");
body.append("requested_entities", "[\"PERSON\", \"EMAIL\", \"PHONE\"]");
const response = await fetch("https://api.declassifai.com/detect/advanced", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "detect_abc123",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 1.2
  },
  "file_results": [
    {
      "file": "document.pdf",
      "status": "success",
      "results": {
        "redaction_mapping": {
          "pages": [
            {
              "page": 1,
              "sensitive": [
                {
                  "engine": "fast",
                  "entity_type": "<the engine's old name for the category>",
                  "start": 0,
                  "end": 13,
                  "score": 0.85,
                  "bbox": {
                    "x0": 70.8,
                    "y0": 789.99,
                    "x1": 131.39,
                    "y1": 795.38
                  }
                }
              ]
            }
          ]
        },
        "entities_detected": {
          "total": 1
        }
      }
    }
  ]
}
POST/batch/detect

Detect in files with one engine

  • Nøkkel
  • Utgående
  • multipart/form-data

Deprecated: use POST /batch/text. This route keeps working until a removal date, which is to be announced. It answers with the headers Deprecation and Link, and with X-Deprecated-Names when the request used old names. Its threshold no longer removes findings. Several files with one engine, chosen with detection_engine.

Felt
  • streamboolean · queryvalgfri

    Answer as Server-Sent Events: file_started, page_completed, file_completed (with the file's coverage), batch_completed. A failure is an error event, never a stream that just ends.

    standard false
  • filesfile[]påkrevd

    Files to read, at most 10

  • requested_entitiesarrayvalgfri

    JSON array of category ids or old names. Old names are aliases: each selects the categories it selected before. See the alias table.

    standard ["ALL_FAST"]
  • detection_enginestringvalgfri

    One of fast, standard, advanced or multi (all three)

    standard fast
  • remove_wordsstringvalgfri

    Words to leave out of the result

  • thresholdnumbervalgfri

    Accepted and range-checked (0.0 to 1.0). It no longer removes findings: each engine has a fixed floor.

  • textbooleanvalgfri

    Include the text of each finding in the response

    standard false
  • pagesstringvalgfri

    JSON object from file name to the 1-based pages to read, for example {"letter.pdf": [2, 4]}. A file with no entry is read whole. Only the selected pages are answered and billed. A page the file does not have is a 422.

  • ocr_wordsbooleanvalgfri

    Return the OCR words of scanned PDF pages on the pages of redaction_mapping. Not with stream=true.

    standard false
Svar
  • 200

    batch_summary and file_results in the shape this route has always had. Each finding is named in the engine's old name for its category (see the alias table).

    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Operation-ID
    The id of this operation, for support
    Deprecation
    true
    Link
    <…/developers#changelog>; rel="deprecation"
  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

The same request on the new route

curl -X POST https://api.declassifai.com/batch/detect \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@document.pdf" \
  -F 'requested_entities=["PERSON", "EMAIL", "PHONE"]'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("files", open("document.pdf", "rb"))]
data = {
    "requested_entities": "[\"PERSON\", \"EMAIL\", \"PHONE\"]",
}

response = requests.post("https://api.declassifai.com/batch/detect", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("files", await openAsBlob("document.pdf"), "document.pdf");
body.append("requested_entities", "[\"PERSON\", \"EMAIL\", \"PHONE\"]");
const response = await fetch("https://api.declassifai.com/batch/detect", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "detect_abc123",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 1.2
  },
  "file_results": [
    {
      "file": "document.pdf",
      "status": "success",
      "results": {
        "redaction_mapping": {
          "pages": [
            {
              "page": 1,
              "sensitive": [
                {
                  "engine": "fast",
                  "entity_type": "<the engine's old name for the category>",
                  "start": 0,
                  "end": 13,
                  "score": 0.85,
                  "bbox": {
                    "x0": 70.8,
                    "y0": 789.99,
                    "x1": 131.39,
                    "y1": 795.38
                  }
                }
              ]
            }
          ]
        },
        "entities_detected": {
          "total": 1
        }
      }
    }
  ]
}
POST/batch/multi_detect

Detect in files with several engines

  • Nøkkel
  • Utgående
  • multipart/form-data

Deprecated: use POST /batch/text. This route keeps working until a removal date, which is to be announced. It answers with the headers Deprecation and Link, and with X-Deprecated-Names when the request used old names. Its threshold no longer removes findings. Several files with several engines, switched on with use_fast, use_standard and use_advanced.

Felt
  • streamboolean · queryvalgfri

    Answer as Server-Sent Events: file_started, page_completed, file_completed (with the file's coverage), batch_completed. A failure is an error event, never a stream that just ends.

    standard false
  • filesfile[]påkrevd

    Files to read, at most 10

  • requested_entitiesarrayvalgfri

    JSON array of category ids or old names. Old names are aliases: each selects the categories it selected before. See the alias table.

    standard ["ALL"]
  • use_fastbooleanvalgfri

    Switch Fast on

    standard true
  • use_standardbooleanvalgfri

    Switch Standard on

    standard false
  • use_advancedbooleanvalgfri

    Switch Advanced on

    standard false
  • remove_wordsstringvalgfri

    Words to leave out of the result

  • thresholdnumbervalgfri

    Accepted and range-checked (0.0 to 1.0). It no longer removes findings: each engine has a fixed floor.

  • textbooleanvalgfri

    Include the text of each finding in the response

    standard false
  • pagesstringvalgfri

    JSON object from file name to the 1-based pages to read, for example {"letter.pdf": [2, 4]}. A file with no entry is read whole. Only the selected pages are answered and billed. A page the file does not have is a 422.

  • ocr_wordsbooleanvalgfri

    Return the OCR words of scanned PDF pages on the pages of redaction_mapping. Not with stream=true.

    standard false
Svar
  • 200

    batch_summary and file_results in the shape this route has always had. Each finding is named in the engine's old name for its category (see the alias table).

    X-Pages-Processed
    Pages read in this request
    X-Pages-Billed
    Pages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
    X-Quota-Used-Before
    Pages used in the billing period before this request
    X-Quota-Used-After
    Pages used after this request
    X-Quota-Limit
    Pages in your plan for the billing period
    X-Usage-Incremented
    true only when this request added pages to the count
    X-Usage-Charge
    What the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
    X-Operation-ID
    The id of this operation, for support
    Deprecation
    true
    Link
    <…/developers#changelog>; rel="deprecation"
  • 401

    No key was sent (SECURITY_AUTHENTICATION_REQUIRED), or the key is not valid (SECURITY_API_KEY_INVALID).

  • 429

    The pages of your plan are used up for this period (VALIDATION_QUOTA_EXCEEDED), or the rate limit was reached (SECURITY_RATE_LIMIT_EXCEEDED, with a Retry-After header). Nothing is charged.

The same request on the new route

curl -X POST https://api.declassifai.com/batch/multi_detect \
  -H "raw-api-key: $DECLASSIFAI_API_KEY" \
  -F "files=@document.pdf" \
  -F 'requested_entities=["PERSON", "EMAIL", "PHONE"]'
import os
import requests

headers = {"raw-api-key": os.environ["DECLASSIFAI_API_KEY"]}
files = [("files", open("document.pdf", "rb"))]
data = {
    "requested_entities": "[\"PERSON\", \"EMAIL\", \"PHONE\"]",
}

response = requests.post("https://api.declassifai.com/batch/multi_detect", headers=headers, files=files, data=data, timeout=120)
response.raise_for_status()
print(response.json())
import { openAsBlob } from "node:fs";
// Node 20 or later: run this on your server, where the key is kept.
const body = new FormData();
body.append("files", await openAsBlob("document.pdf"), "document.pdf");
body.append("requested_entities", "[\"PERSON\", \"EMAIL\", \"PHONE\"]");
const response = await fetch("https://api.declassifai.com/batch/multi_detect", { method: "POST", body, headers: { "raw-api-key": process.env.DECLASSIFAI_API_KEY } });
console.log(response.status, await response.json());
Svar · 200
{
  "batch_summary": {
    "batch_id": "detect_abc123",
    "total_files": 1,
    "successful": 1,
    "failed": 0,
    "total_time": 1.2
  },
  "file_results": [
    {
      "file": "document.pdf",
      "status": "success",
      "results": {
        "redaction_mapping": {
          "pages": [
            {
              "page": 1,
              "sensitive": [
                {
                  "engine": "fast",
                  "entity_type": "<the engine's old name for the category>",
                  "start": 0,
                  "end": 13,
                  "score": 0.85,
                  "bbox": {
                    "x0": 70.8,
                    "y0": 789.99,
                    "x1": 131.39,
                    "y1": 795.38
                  }
                }
              ]
            }
          ]
        },
        "entities_detected": {
          "total": 1
        }
      }
    }
  ]
}

Feil

Alle avvisninger har samme form. Les error.code, ikke meldingen: koden står fast, ordlyden kan endres. trace_id er det brukerstøtte spør etter.

Slik ser en feil ut
{
  "error": {
    "code": "SECURITY_AUTHENTICATION_REQUIRED",
    "message": "Authentication required for this endpoint",
    "details": {
      "resource_type": "api_key/session_key"
    },
    "trace_id": "trace_1763283600_1a2b3c4d",
    "timestamp": "2026-11-16T09:00:00.000000+00:00Z"
  },
  "status": "error",
  "status_code": 401
}
StatusKodeHva det betyrHva du gjør
400VALIDATION_INVALID_FORMATA field is not in the form the route takes, for example redaction mappings that are not valid JSON. A form field over 1 MB is also a 400, refused before the route reads it.Fix the field named in details.field and send again.
401SECURITY_AUTHENTICATION_REQUIREDNo key was sent.Send your key in the raw-api-key header.
401SECURITY_API_KEY_INVALIDThe key is not valid: mistyped, revoked or expired.Check the key, or create a new one.
402VALIDATION_SUBSCRIPTION_NOT_FOUNDThere is no active plan behind the key. Other 402 codes say the plan has ended or is not active.Choose or renew a plan.
403SECURITY_IP_BANNEDYour address went over the rate limit too often and is blocked for a while. details.retry_after is the seconds left.Wait for Retry-After, then slow down.
409BUSINESS_LOGIC_ADVANCED_DETECTION_UNAVAILABLEA feature this installation does not offer (Advanced, or AI search: BUSINESS_LOGIC_AI_SEARCH_UNAVAILABLE).Use another engine, or plain search. Retrying will not help.
413VALIDATION_FILE_TOO_LARGEA file is over the limit of its format.Split the file, or send a smaller one.
415VALIDATION_UNSUPPORTED_MEDIA_TYPEThe format is refused: .doc, .xls, .ppt and macro-enabled Office files.Save the file as DOCX, XLSX, PPTX or PDF.
422VALIDATION_VALIDATION_FAILEDThe request is well formed but cannot be done: categories that select nothing, an engine that is not run here, a page the file does not have.Read error.message, which names the field; nothing was charged.
422BUSINESS_LOGIC_REDACTION_VERIFICATION_FAILEDThe redacted output failed the check that runs after every redaction, so no file was returned.Read details.verification. Redact the listed pages whole (redact_whole_unit), or review them, and send again.
422BUSINESS_LOGIC_DOCUMENT_UNREADABLEThe document cannot be read: details.reason is password_protected, damaged or unreadable.Remove the password, or send a readable copy.
429SECURITY_RATE_LIMIT_EXCEEDEDToo many requests from your address to this route in this minute.Wait for Retry-After (seconds), then send again.
429VALIDATION_QUOTA_EXCEEDEDThe pages of your plan are used up for this billing period.Wait for the next period, or move to a larger plan.
503SYSTEM_SERVICE_UNAVAILABLEA service behind the API is not ready.Retry shortly; nothing was charged.

Grenser for antall forespørsler

Forespørsler telles per API-nøkkel, per innlogget bruker eller, for anonyme kall, per IP-adresse. Standardgrensene er nå 100 forespørsler i minuttet og 200 i timen. De kan endres, så les X-RateLimit-Limit og X-RateLimit-Remaining på hvert svar som telles, i stedet for et tall skrevet her:

HeaderHva det betyr
X-RateLimit-LimitRequests allowed per minute on this route
X-RateLimit-RemainingRequests left in this minute
X-RateLimit-ResetWhen the minute ends, in Unix seconds
Retry-AfterOn a 429 or a 403 ban: seconds to wait
  • Over grensen er svaret 429 SECURITY_RATE_LIMIT_EXCEEDED med en Retry-After-header, og details.retry_after i svaret. Vent så mange sekunder.
  • En adresse som går over grensen gang på gang, blokkeres en stund: 403 SECURITY_IP_BANNED, med Retry-After og details.retry_after.
  • GET /status og GET /health telles ikke. Hjelperutene har egne grenser.
  • Forespørsler for bilder, video og samlet søk telles foreløpig per IP-adresse, ikke per nøkkel.
  • Når sidene i planen er brukt opp, er det en annen 429: VALIDATION_QUOTA_EXCEEDED. Da hjelper det ikke å vente et minutt, men neste periode eller en større plan gjør det.
429 · SECURITY_RATE_LIMIT_EXCEEDED
{
  "error": {
    "code": "SECURITY_RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Please try again later.",
    "details": {
      "limit": 30,
      "window": 60,
      "retry_after": 23
    },
    "trace_id": "trace_1763283600_1a2b3c4d",
    "timestamp": "2026-11-16T09:00:00.000000+00:00Z"
  },
  "status": "error",
  "status_code": 429
}

En blokkert adresse:

403 · SECURITY_IP_BANNED
{
  "error": {
    "code": "SECURITY_IP_BANNED",
    "message": "Access denied. Your IP has been banned. Reason: rate_limit_violation",
    "details": {
      "reason": "rate_limit_violation",
      "retry_after": 287
    },
    "trace_id": "trace_1763283600_1a2b3c4d",
    "timestamp": "2026-11-16T09:00:00.000000+00:00Z"
  },
  "status": "error",
  "status_code": 403
}

Forbruk og fakturering i headerne

Rutene som teller sider (deteksjon, og søk med ai_search), oppgir hva de telte. Den samme forespørselen i samme faktureringsperiode belastes én gang.

HeaderHva det betyr
X-Pages-ProcessedPages read in this request
X-Pages-BilledPages counted against your plan. Less than X-Pages-Processed only for pages we could not check for a reason on our side
X-Quota-Used-BeforePages used in the billing period before this request
X-Quota-Used-AfterPages used after this request
X-Quota-LimitPages in your plan for the billing period
X-Usage-Incrementedtrue only when this request added pages to the count
X-Usage-ChargeWhat the count did: charged, already_charged (the same request earlier in the period), nothing_billable, over_quota, failed or not_counted
X-Operation-IDThe id of this operation, for support

Endringslogg

  • 2026-11-14: plain values are always accepted from API-key requests

    A request that carries only raw-api-key is never refused for a plain value. A field may also be sealed (AES-GCM under your key); only a value that opens is decrypted, and the answer is encrypted only when something in the request was.

  • 2026-11-12: read only some pages

    POST /batch/text, POST /batch/detect and POST /batch/multi_detect take an optional pages: a JSON object from file name to the 1-based pages to read. The answer, its coverage and the billing cover only those pages.

  • 2026-11-07: one category list and engine switches

    Adds POST /batch/text, categories and engines on POST /text/detect, and GET /help/text-categories. The old routes and names keep working until a removal date, which is to be announced.

    1. One category list (59 ids) and engines as switches, with a per-category status.
    2. The threshold no longer removes findings. Each engine has a fixed floor. This replaces the default of 0.5 from 2026-11-06.
    3. If you sent a threshold under 0.5, Standard and Advanced findings under 0.5 are no longer returned.
    4. If you sent a threshold above 0.5, you now get every finding above the floor.
    5. The pattern rules run for every engine, so Advanced alone returns more boxes.
    6. The old names are aliases, with deprecation headers on the old routes.
    7. On /redact, /pdf/redact and /batch/redact, requested_entities with ALL or one of the old group names now selects all four pattern categories (national identity number, bank account, e-mail, phone). Before, these names selected none.
    8. The text part of the photo routes takes category ids and ALL in text.entities. A text region is named after its category. The photo contract is version 1.1.0.
    9. Billing: pages are left unbilled only for the reasons above, at most 50 %. /text/detect counts pages and needs an active plan. A repeat is not charged again.
    10. A sealed request gets a sealed stream on /batch/text, /batch/detect and /batch/multi_detect.
    11. /text/redact has its own size limits: text and redaction_mapping are each limited to 1 MB. A form field over 1 MB already got a 400.
  • 2026-11-06: default threshold

    The default threshold became 0.5 (it was 0.8). 2026-11-07 replaces this: the threshold no longer removes findings.

Prøv selv

Send en forespørsel til API-et fra denne siden med din egen nøkkel. Nøkkelen blir i denne fanen: den lagres ikke og sendes ikke noe annet sted enn til api.declassifai.com.

Sendes bare i raw-api-key-headeren i denne forespørselen.

DeclassifAI

Laget i Gjøvik av Safe Media AI AS.

Vinner av NTNUs Eurekapris 2025. Støttet av Innovasjon Norge.

Besøk Safe Media AI

PRODUKT

  • Funksjoner
  • Bruksområder
  • Slik fungerer det
  • Bedrift
  • Video

RESSURSER

  • API-dokumentasjon
  • Sikkerhet
  • Driftsstatus

SELSKAPET

  • Om oss
  • Kontakt

JURIDISK

  • Personvern
  • Vilkår
© 2026 Safe Media AI AS · Gjøvik