v7

latestOpenAPI 3.1.0raw.githubusercontent.com2025-06-30132748.5 KB
Utilities

Transform unstructured text to structured JSON

Transforms unstructured text into structured JSON according to a provided schema. This utility endpoint extracts specific data patterns from free-form content.

post/v1/utils/text-to-json

Request body

textstring required

Unstructured text to transform

schemaobject required

JSON Schema for transforming text into structured data

Example request

{
  "text": "Patient is a 45-year-old male presenting with chest pain...",
  "schema": {
    "type": "object",
    "properties": {
      "patientInfo": {
        "type": "object",
        "properties": {
          "age": {
            "type": "number"
          },
          "gender": {
            "type": "string"
          },
          "allergies": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "age",
          "gender",
          "allergies"
        ]
      },
      "symptoms": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "diagnosis": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "severityLevel": {
        "type": "string",
        "enum": [
          "mild",
          "moderate",
          "severe",
          "critical"
        ]
      },
      "notes": {
        "type": [
          "string",
          "null"
        ],
        "description": "Optional clinical notes that might be null"
      }
    },
    "required": [
      "patientInfo",
      "symptoms",
      "diagnosis",
      "severityLevel",
      "notes"
    ]
  }
}

Response

JSON data extracted from text

dataobject

Extracted structured data that conforms to the provided schema

Example response

{
  "data": {
    "patientInfo": {
      "age": 45,
      "gender": "male",
      "allergies": null
    },
    "symptoms": [
      "chest pain"
    ],
    "diagnosis": [],
    "severityLevel": "moderate",
    "notes": null
  }
}