Developer documentation · v1

PROBITAS API Reference

This reference describes the PROBITAS API v1 analytics endpoints, their request fields, and their response formats. PROBITAS is a proof of concept; its outputs are analytical indicators, not validated diagnoses, proof of misconduct, or determinations that a person is corrupt.

Base URL and authentication

The API v1 base path is /v1/api/. Analytics endpoints accept authenticated POST requests. Send an active subscriber API key in the Authorization header:

Authorization: api_key YOUR_API_KEY

Subscriber account login and API key management are provided by AKMM routes separately from the analytics API.

Endpoint summary

Method and pathPurposeResponse
POST /report-summary/Summarize one or more PDF reports202 · queued
POST /construct-analysis/Analyze report materials with HR assessment inputs202 · queued
POST /reports-vector-embeddings/Create an embedding for a report summary202 · task ID and queued status
POST /report-comparison/Compare reports supplied by external report identifier202 · task ID and queued status
POST /conflict-interest-screening/Select eligible HR or approving-body screeners200 · selected screeners
POST /calculate-risk/Calculate participant risk indicators and observation categories200 · calculation response
POST /vector-comparison/Compare report embeddings by cosine similarity202 · task ID and queued status
GET /tasks/{task_id}/Check an AM task owned by the authenticated subscriber202 queued / processing · 200 completed / failed · 404 unknown or not owned · 410 expired

Paths are relative to /v1/api/. Queued analytics calls return a task ID. Polling is a normal HTTP GET; the SDK does not listen for server events. Results are kept in the Celery result backend for 15 minutes after completion; expired results return 410 Gone. Unknown tasks and tasks owned by another account both return 404.

Python SDK methods

The PROBITAS SDK provides a Probitas client. Its callable resources map to API v1 requests:

SDK methodRequestWhat it does
client.report_summary(...)POST /report-summary/Submits PDF report files or URLs for summary generation
client.construct_analysis(...)POST /construct-analysis/Submits report materials, evidence, and HR assessments for construct analysis
client.reports_vector_embeddings(...)POST /reports-vector-embeddings/Creates a vector embedding from a report summary
client.reports_comparison(...)POST /report-comparison/Submits keyed report files for comparison
client.vector_comparison(...)POST /vector-comparison/Submits report vectors for cosine similarity comparison
client.get_task(task_id)GET /tasks/{task_id}/Makes one status request; call again later while queued or processing
client.calculate_risk(...)POST /calculate-risk/Submits project participants for risk calculation
client.conflict_of_interest.screen_hr_conflict(...)POST /conflict-interest-screening/Selects eligible screeners for HR conflict screening
client.conflict_of_interest.screen_approving_bodies_conflict(...)POST /conflict-interest-screening/Selects eligible screeners for approving-body conflict screening

Create the client with an API key, call the resource that matches the operation, then close the client when finished. The client also supports Python's with statement for automatic cleanup.

from probitas import Probitas

with Probitas(api_key="YOUR_API_KEY") as client:
    result = client.reports_vector_embeddings("Report summary text")

Receive an asynchronous result

The POST response returns immediately with task_id and status: "queued". Save that ID and call client.get_task(task_id) periodically. Each call sends one HTTP GET; it does not hold a connection open or subscribe to an event stream. Wait briefly between calls. When status is succeeded, the response contains result. A failed task returns status: "failed" and a generic detail message.

import time
from probitas import Probitas

with Probitas(api_key="YOUR_API_KEY") as client:
    submitted = client.reports_vector_embeddings("Report summary text")
    task_id = submitted["task_id"]
    delay = 5

    while True:
        task = client.get_task(task_id)
        if task["status"] == "succeeded":
            analytics_result = task["result"]
            break
        if task["status"] == "failed":
            raise RuntimeError(task.get("detail", "Analysis failed"))
        time.sleep(delay)  # queued or processing; make another GET after a short wait
        delay = min(delay * 2, 30)  # back off to avoid unnecessary polling

A completed result is only available for 15 minutes. A 410 response means it has expired; the SDK raises ProbitasAPIError for HTTP errors. Keep the task ID and API key private.

Example responses

202  {"task_id":"…","status":"queued"}
202  {"task_id":"…","status":"processing"}
200  {"task_id":"…","status":"succeeded","result":{…}}
200  {"task_id":"…","status":"failed","detail":"The analysis task failed."}

Report summary

POST/report-summary/

Submit PDF files using multipart form data in report_files, or submit PDF URLs in a JSON list named report_files_urls. At least one source is required.

{ "report_files_urls": ["https://example.org/report.pdf"] }

202 Accepted · response includes a task_id. Poll GET /tasks/{task_id}/ for status and the result when complete.

For every async AM endpoint, the complete request payload is staged briefly so Celery messages carry only a task ID, subscriber ID, and payload path. Set AM_TEMP_UPLOAD_DIR to the same shared directory for the API process and its workers. Successful results remain available for 15 minutes after completion.

Construct analysis

POST/construct-analysis/

Provide report PDFs in report_files or URLs in report_files_urls. Evidence images can be supplied as report_images or image URLs as report_image_urls.

The HR assessment fields are hr_staff_ids, submitted_validator_ids, and hr_assessments, an object mapping validator IDs to assessment text. Submitted validator IDs must be unique and included in the staff IDs. Each submitted validator must have an assessment, and the assessment count must be at least two-thirds of the staff population, rounded up.

202 Accepted · {"status":"queued"}

Vector embedding and report comparison

POST/reports-vector-embeddings/

Send a JSON body with report_summary. The embedding service converts the summary into a vector representation using qwen3-embedding:8b.

202 Accepted · {"task_id":"…","status":"queued"}

POST/report-comparison/

Supply reports in report_files and/or report_files_urls, as objects keyed by external report identifier. The comparison service examines report pairs using qwen3.5:9b.

202 Accepted · {"task_id":"…","status":"queued"}

POST/vector-comparison/

Send a JSON object named reports_vector mapping report IDs to numeric embedding arrays. The endpoint calculates cosine similarity and returns pairs whose similarity is at least 0.8.

{ "reports_vector": { "report-1": [0.1, 0.2], "report-2": [0.2, 0.3] } }

202 Accepted · {"task_id":"…","status":"queued"}

Conflict-of-interest screening

POST/conflict-interest-screening/

JSON fields are screening_type (hr or approving_bodies), subject_ids, and screener_ids. HR screening also requires reporter_ids. HR screening removes reporters and subjects from eligible screeners; approving-body screening removes subjects. The endpoint randomly selects the ceiling of two-thirds of the remaining unique eligible IDs.

{
  "screening_type": "hr",
  "reporter_ids": ["employee-1"],
  "subject_ids": ["employee-2"],
  "screener_ids": ["employee-1", "employee-2", "employee-3", "employee-4"]
}

200 OK · {"screeners":["employee-3","employee-4"]} (selected IDs vary)

Risk calculation

POST/calculate-risk/

Provide project_name, project_start_date in YYYY-MM-DD format, and project_participants, an object whose values are lists of participants. Each participant contains employee_id, four construct averages named employee_construct1_average through employee_construct4_average (each from 0 to 1), employee_total_reports, employee_tenure as a date, employee_position, and employee_recent_report_dates as a list of dates.

The framework specifies four weighted components: construct mean (60%), reports relative to tenure (10%), employee position (10%), and temporal risk (20%). The construct mean weights Psychopathy by 1.10 before averaging the four construct means.

Available position values are EXECUTIVE_AUTHORITY (1.20), DEPARTMENT_HEAD (1.15), SUPERVISORY (1.10), ADMINISTRATIVE_TECHNICAL (1.05), and GENERAL_PERSONNEL (1.00).

Observation sufficiency uses the validated report count: INSUFFICIENT (1–2), LIMITED (3–5), PRELIMINARY (6–9), MODERATE (10–14), and EXTENSIVE (15 or more). Zero reports has no category. This category gives report-count context and is separate from the numerical risk score.

Data handling and interpretation

AKMM manages persistent subscriber and account data. AM processes analytical requests and returns results without maintaining a permanent repository of submitted analytical data. PAM records minimal API operational metadata. Client applications own organizational records and employee-level analytics. HR assessments are analytical inputs, and AI-generated construct scores and risk scores are not scientific diagnoses or determinations of corruption.