Skip to content
Get started

Upload And Process File

v1.layers.upload_and_process_file(LayerUploadAndProcessFileParams**kwargs) -> LayerUploadAndProcessFileResponse
POST/api/v1/layers/process-file

Upload a single file, extract text (txt, docx, pdf, or images), run input-layer policies to hide sensitive data, and return processed file.

For images (jpg, jpeg, png, gif, webp): Uses OCR and PII obfuscation. For PDFs: Attempts normal extraction first; if no text found, uses OCR. For text files: Standard text extraction and processing.

ParametersExpand Collapse
file: FileTypes
formatbinary
use_cache: Optional[bool]
ReturnsExpand Collapse
class LayerUploadAndProcessFileResponse:

Response returned by /layers/process-file.

overall_policy_outcome: str
policy_results: Dict[str, Dict[str, object]]
processed_file: Dict[str, object]
span_context: Dict[str, str]
processed_data: Optional[str]
Upload And Process File
from overmind_lab import OvermindLab

client = OvermindLab()
response = client.v1.layers.upload_and_process_file(
    file=b"raw file contents",
)
print(response.overall_policy_outcome)
{
  "overall_policy_outcome": "overall_policy_outcome",
  "policy_results": {
    "foo": {
      "foo": "bar"
    }
  },
  "processed_file": {
    "foo": "bar"
  },
  "span_context": {
    "foo": "string"
  },
  "processed_data": "processed_data"
}
Returns Examples
{
  "overall_policy_outcome": "overall_policy_outcome",
  "policy_results": {
    "foo": {
      "foo": "bar"
    }
  },
  "processed_file": {
    "foo": "bar"
  },
  "span_context": {
    "foo": "string"
  },
  "processed_data": "processed_data"
}