Skip to content

Job Status & Results

Poll for job completion and retrieve the anonymized result.

Endpoint

GET /anonymize/status/{job_id}

Try it live (desktop). The API Playground docked on the right is set to the Job Status endpoint. The job ID from your last file upload is filled in automatically; use Poll to re-check until the job completes, then download the decoded result.

Request

ParameterTypeDescription
job_idstringJob ID returned from a file upload endpoint

Response

200 OK (Completed)

json
{
  "status": "completed",
  "progress": 100,
  "file_type": "pdf",
  "result": "JVBERi0xLjQK...",
  "de_anonymization_map": {
    "John Doe": "[PERSON_NAME_1]"
  },
  "entity_count": 5,
  "error": null,
  "created_at": 1678886400.0
}

Fields

FieldTypeDescription
statusstringqueued, processing, completed, failed
progressintProgress percentage (0–100)
file_typestringType of file being processed
resultstringBase64-encoded anonymized file (completed only)
de_anonymization_mapobjectOriginal value to placeholder mapping
entity_countintTotal entities detected
errorstringError message (failed only)
created_atfloatUnix timestamp of job creation

Polling Example (Python)

python
import requests
import base64
import time

headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

while True:
    response = requests.get(
        f"https://demo.questa-ai.online/anonymize/status/{JOB_ID}",
        headers=headers
    )
    result = response.json()

    if result["status"] == "completed":
        file_data = base64.b64decode(result["result"])
        with open("anonymized_output.pdf", "wb") as f:
            f.write(file_data)
        print(f"Done. Entities found: {result['entity_count']}")
        break

    elif result["status"] == "failed":
        print(f"Error: {result['error']}")
        break

    time.sleep(1)

Decoding the Result

The result field is a Base64-encoded string of the anonymized file.

Python

python
import base64

# Binary files (PDF, DOCX, Excel)
with open("output.pdf", "wb") as f:
    f.write(base64.b64decode(job["result"]))

# CSV (text)
csv_text = base64.b64decode(job["result"]).decode("utf-8")

JavaScript

javascript
import { Buffer } from "node:buffer";
import fs from "node:fs";

const buffer = Buffer.from(job.result, "base64");
fs.writeFileSync("output.pdf", buffer);

Bash

bash
echo "$BASE64_RESULT" | base64 -d > output.pdf

Error: Not Found

404:

json
{
  "detail": "Job not found"
}

Job results are retained for 1 hour after completion.

Questa AI documentation.