Appearance
File Anonymization
Asynchronous endpoints for anonymizing documents. Upload a file, receive a job ID, then poll for the result.
Supported Formats
| Format | Endpoint | Extension |
|---|---|---|
POST /anonymize/pdf | .pdf | |
| Word | POST /anonymize/docx | .docx |
| CSV | POST /anonymize/csv | .csv |
| Excel | POST /anonymize/excel | .xlsx |
Common Endpoint
POST /anonymize/{format}Request
Headers
| Header | Value |
|---|---|
Content-Type | multipart/form-data |
Authorization | Bearer <token> (hosted demo only) |
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | File to anonymize |
entities | string | No | Comma-separated entity type names |
start_index | int | No | Starting placeholder index (default 0) |
custom_entities | string | No | JSON string: [{"original":"term","placeholder":"NAME"}] |
Response
202 Accepted
json
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "PDF anonymization job started."
}Fields
| Field | Type | Description |
|---|---|---|
job_id | string | UUID for tracking the job |
message | string | Confirmation message |
Examples
cURL
bash
curl -X POST https://demo.questa-ai.online/anonymize/pdf \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "file=@document.pdf" \
-F "entities=PERSON_NAME,EMAIL_ADDRESS"Python
python
import requests
url = "https://demo.questa-ai.online/anonymize/pdf"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}
files = {"file": open("document.pdf", "rb")}
data = {"entities": "PERSON_NAME,EMAIL_ADDRESS,PHONE_NUMBER"}
response = requests.post(url, headers=headers, files=files, data=data)
job = response.json()
print(f"Job ID: {job['job_id']}")JavaScript
javascript
const formData = new FormData();
formData.append("file", fileInput.files[0]);
formData.append("entities", "PERSON_NAME,EMAIL_ADDRESS");
const response = await fetch("https://demo.questa-ai.online/anonymize/pdf", {
method: "POST",
headers: { Authorization: "Bearer YOUR_API_TOKEN" },
body: formData,
});
const { job_id } = await response.json();