Processing CSV Files

Private AI supports scanning Comma Separated Value (CSV) files for PII and creating de-identified or redacted copies. Private AI’s supported entity types function across each file type, with localized variants of different PII (Personally Identifiable Information) entities, PHI (Protected Health Information) entities, and PCI (Payment Card Industry) entities being detected. Our Supported Languages and Supported Entity Types page provides a more detailed look.

How CSV Files Are Processed

Similar to Excel files, CSV files are processed using the method described for Tabular Data in the Structured Data Guide. The output file retains its original format with labels in place of the detected PII.



Please consider writing a handler for your specific application using the Structured Data Guide to get around any of the constraints listed below.

  • The file processing routes are synchronous, meaning that large files over 10MB in size may take a long time to process.
  • The data in the CSV file must be row-oriented (i.e. each row represents a separate record) and the headers must be on the first row.
  • Files must adhere to the csv file standards .

Support Matrix

CPU Container GPU Container Demo API Prod API PrivateGPT UI
Supported? Yes Yes No Yes No

Sample Request


Please sign up for a free API key to run this code.

import requests
import base64

file_url = "$web/sample.csv"
file_content = requests.get(file_url).content
file_content_base64 = base64.b64encode(file_content).decode()

headers = {"Content-Type": "application/json", "x-api-key": "<INSERT API KEY>"}

url = ""

payload = {
    "data": file_content_base64,
    "content_type": "text/csv",
  "entity_detection": {
    "accuracy": "high",
    "return_entity": True

response =, json=payload, headers=headers)

Sample Response

"processed_file": "Base64 Encoded File Content of the Redacted File",
"languages_detected":{"lang_1":0.67, "lang_2", 0.74}
© Copyright 2024 Private AI.