import os
from dataframer import Dataframer
client = Dataframer(
api_key=os.environ.get("DATAFRAMER_API_KEY"), # This is the default and can be omitted
)
anonymization_run = client.dataframer.anonymization_runs.create(
dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
detection_method="pii_m1",
pii_types=["string"],
)
print(anonymization_run.id)curl https://df-api.dataframer.ai/api/dataframer/anonymization-runs/ \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $DATAFRAMER_API_KEY" \
-d '{
"dataset_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"detection_method": "pii_m1",
"pii_types": [
"string"
]
}'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "PENDING",
"dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dataset_name": "<string>",
"pii_types": [
"<string>"
],
"detection_method": "<string>",
"llm_model_name": "<string>",
"created_by_email": "jsmith@example.com",
"duration_seconds": 123,
"results": {
"entity_summary": {},
"samples_processed": 123,
"entities_found": [
{
"start": 123,
"end": 123,
"label": "<string>",
"score": 123
}
],
"error": "<string>"
},
"anonymized_files": [
{
"id": "<string>",
"path": "<string>",
"size_in_bytes": 123,
"content_type": "<string>"
}
],
"completed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}Create an Anonymization Run
Start a new anonymization run to detect and mask sensitive data on your data
import os
from dataframer import Dataframer
client = Dataframer(
api_key=os.environ.get("DATAFRAMER_API_KEY"), # This is the default and can be omitted
)
anonymization_run = client.dataframer.anonymization_runs.create(
dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
detection_method="pii_m1",
pii_types=["string"],
)
print(anonymization_run.id)curl https://df-api.dataframer.ai/api/dataframer/anonymization-runs/ \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $DATAFRAMER_API_KEY" \
-d '{
"dataset_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"detection_method": "pii_m1",
"pii_types": [
"string"
]
}'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "PENDING",
"dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dataset_name": "<string>",
"pii_types": [
"<string>"
],
"detection_method": "<string>",
"llm_model_name": "<string>",
"created_by_email": "jsmith@example.com",
"duration_seconds": 123,
"results": {
"entity_summary": {},
"samples_processed": 123,
"entities_found": [
{
"start": 123,
"end": 123,
"label": "<string>",
"score": 123
}
],
"error": "<string>"
},
"anonymized_files": [
{
"id": "<string>",
"path": "<string>",
"size_in_bytes": 123,
"content_type": "<string>"
}
],
"completed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}GET /api/dataframer/anonymization-runs/{run_id}/ until status is SUCCEEDED or FAILED.Authorizations
API Key authentication. Format: "Bearer YOUR_API_KEY"
Body
Request body for creating an anonymization run.
UUID of the seed dataset to anonymize.
List of PII/PHI entity types to detect and mask (e.g. ["first_name", "email", "phone_number"]). All values must be lowercase.
Entity detection method. pii_m1 is the default and recommended option. Use llm or all when you need LLM-based detection; supply llm_model_name in that case.
pii_m1, llm, all LLM model name. Required when detection_method includes llm.
Optional per-entity-type masking strategy, e.g. {"first_name": "<FIRST_NAME>", "email": "<EMAIL>"}. Defaults to redact all.
Show child attributes
Show child attributes
Confidence threshold for entity detection (0.0–1.0). Lower values detect more entities; higher values reduce false positives.
0 <= x <= 1Response
Anonymization run created
Unique identifier for the anonymization run.
Current status of the anonymization run.
PENDING, PROCESSING, SUCCEEDED, FAILED UUID of the seed dataset being anonymized.
Name of the seed dataset.
List of PII/PHI entity types being detected.
Entity detection method used.
LLM model name (when detection_method includes llm).
Email of the user who created this run.
Time taken to complete the run in seconds. Null until completed.
Anonymization results once the run completes.
Show child attributes
Show child attributes
List of anonymized output files produced by the run.
Show child attributes
Show child attributes
When the run completed (succeeded or failed).
When the run was created.

