Wald.ai logo

Key Endpoints

1. Sanitization API

Endpoint: POST /sanitize

Purpose: Redacts sensitive information based on context and domain.

Request Parameters:

  • text (required): The raw text to sanitize.
  • domain (optional): Context-specific domain (e.g., Health or Finance).
  • context_mappings (optional): Redaction map if one exists from previous conversations.
  • context (optional): Redacted history of conversation.

Response Parameters:

  • is_sensitive: Indicates if sensitive data was detected.

  • context_mappings: Redactions generated by the API. To be used for de-sanitization and subsequent sanitization API calls

  • sanitized_text: Text with sensitive details contextually redacted.

  • sanitization_result:
    status: Success if the sanitization was done successfully
    reason: If sanitization status is Fail, reason for it. Some reasons:

    • Prompt has Code
    • Invalid conversation id
    • Too long input text

Sample API Call: Sanitization

curl -X POST "https://api.wald.ai/sanitize" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $WALD_API_KEY" \
  -d '{
    "text": "The doctor reviewed the medical report of John Doe, a 65 year old male, who presented with symptoms of chest pain and shortness of breath.Based on the findings, the patient has been advised to follow up with a cardiologist and adhere to a low-sodium diet.
.",
     "domain": "Health",
     "context": "",
     "context_mappings": ""
  }'


Response:

{
   "is_sensitive": true,
  "sanitization_result": {
    "status": "Success",
    "reason": ""
  },
   "context_mappings": {
        "[REDACTED AGE1]": "65",
        "REDACTED PATIENT1]": "John Doe"
    },
   “sanitized_text”: “The doctor reviewed the medical report of [REDACTED PATIENT1], a [REDACTED AGE1] year old male, who presented with symptoms of chest pain and shortness of breath.Based on the findings, the patient has been advised to follow up with a cardiologist and adhere to a low-sodium diet.”}



2. De-sanitization API

Endpoint: POST /desanitize

Purpose: Reconstructs original text from sanitized input using obfuscation maps.

Request Parameters:

  • redacted_text (required): The sanitized text.
  • context_mappings (required): Redaction map to be used for desanitization.

Response Parameters:

  • desanitized_text : Reconstructed original text.

Sample API Call: De-Sanitization

curl -X POST "https://api.wald.ai/desanitize" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $WALD_API_KEY" \
  -d '{
      "redacted_text": "The doctor reviewed the medical report of [REDACTED PATIENT1], a [REDACTED AGE1] year old male, who presented with symptoms of chest pain and shortness of breath.Based on the findings, the patient has been advised to follow up with a cardiologist and adhere to a low-sodium diet",
      "context_mappings": {
        "[REDACTED AGE1]": "65",
        "[REDACTED PATIENT1]": "John Doe"
    }
  }'


Response:

{
    "desanitized_text": "The doctor reviewed the medical report of John Doe, a 65 year old male, who presented with symptoms of chest pain and shortness of breath.Based on the findings, the patient has been advised to follow up with a cardiologist and adhere to a low-sodium diet.",

}


Have Feedback?

Write to us at questions@wald.ai with questions or feedback.