> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sully.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Transform Text to JSON

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



## OpenAPI

````yaml POST /v1/utils/text-to-json
openapi: 3.1.0
info:
  title: Sully API
  description: >
    The Sully API is a robust platform designed to empower healthcare technology
    companies and Electronic Health Record (EHR) vendors by integrating advanced
    AI-driven clinical capabilities to help save healthcare providers (HCPs)
    time and make better decisions.


    ## V2 Audio Transcriptions


    The V2 Audio Transcriptions API provides enhanced audio transcription
    services using advanced AI models with improved accuracy and language
    support.


    ### Authentication


    The API uses API key authentication. You must include both:

    - `X-API-Key`: Your API key

    - `X-Account-Id`: Your account identifier


    ### Rate Limiting


    The API implements rate limiting to ensure fair usage. Rate limit
    information is returned in response headers:

    - `X-RateLimit-Limit`: Maximum requests allowed

    - `X-RateLimit-Remaining`: Remaining requests in current window

    - `X-RateLimit-Reset`: When the rate limit resets


    ### Audio File Support


    Supported audio formats:

    - WAV (audio/wav, audio/wave, audio/x-wav)

    - MP3 (audio/mpeg, audio/mp3)

    - FLAC (audio/flac)

    - OGG (audio/ogg)

    - WebM (audio/webm)

    - MP4 (audio/mp4)

    - M4A (audio/m4a)

    - AAC (audio/aac)

    - Opus (audio/opus)


    Maximum file size: 100MB


    ### Language Support


    The API supports multiple languages, including:

    - English (en, en-US) with medical-optimized transcription

    - Spanish (es), German (de), French (fr), Hindi (hi), Italian (it), Japanese
    (ja), Dutch (nl), Portuguese (pt), and Russian (ru)

    - Additional support for languages including Chinese, Korean, and others


    ### Processing


    V2 Transcriptions are processed asynchronously:

    1. Upload returns immediately with `pending` status

    2. Processing happens in the background

    3. Status updates to `processing`, then `completed` or `failed`

    4. Webhook notifications are sent when processing completes (if configured)


    ### Dictation


    V2 transcriptions support an optional `dictation` boolean field.

    When enabled, the transcript is formatted for dictation-style output.

    The default is `false`.
  version: 0.2.0
servers:
  - url: https://api.sully.ai
    description: Sully Production API
  - url: https://api-testing.sully.ai
    description: Sully Testing API
security:
  - apiKeyAuth: []
    accountIdAuth: []
tags:
  - name: Notes
    description: >-
      Operations for creating and managing clinical notes from medical
      encounters
  - name: Note Styles
    description: Operations for managing templates and formatting styles for clinical notes
  - name: Audio Transcriptions
    description: >-
      Operations for converting medical audio to text, including streaming
      capability
  - name: V2 Transcriptions
    description: >
      V2 Audio transcription operations with enhanced features


      The V2 Transcriptions API allows you to convert audio files to text using
      advanced AI models.

      Features include:

      - Multi-language support with specialized medical models

      - Speaker diarization (identifying different speakers)

      - Word-level timestamps and confidence scores

      - Automatic audio format conversion

      - Optional dictation-oriented transcript formatting

      - Asynchronous processing with webhook notifications
  - name: Utilities
    description: Utility operations for transforming and processing medical data
  - name: Codings
    description: >-
      Operations for medical coding analysis including ICD-10 and CPT code
      extraction
  - name: Macros
    description: >-
      Operations for detecting and expanding text macros in medical
      documentation
paths:
  /v1/utils/text-to-json:
    post:
      tags:
        - Utilities
      summary: Transform unstructured text to structured JSON
      description: >-
        Transforms unstructured text into structured JSON according to a
        provided schema. This utility endpoint extracts specific data patterns
        from free-form content.
      operationId: transformTextToJson
      requestBody:
        description: Text and schema for transformation
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextToJsonPayload'
        required: true
      responses:
        '200':
          description: JSON data extracted from text
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextToJsonResponse'
        '400':
          description: Invalid input or schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server-side processing error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TextToJsonPayload:
      type: object
      description: Request payload for transforming unstructured text into structured JSON
      required:
        - text
        - schema
      properties:
        text:
          type: string
          description: Unstructured text to transform
          example: Patient is a 45-year-old male presenting with chest pain...
        schema:
          type: object
          description: >-
            JSON Schema defining the structure to extract from the text. Use
            `description` fields on properties to guide the model — they act as
            extraction instructions (e.g. "only include confirmed diagnoses, not
            suspected ones").
          example:
            type: object
            description: >-
              Structured clinical summary extracted from a patient encounter
              note
            properties:
              patientInfo:
                type: object
                description: Demographic details about the patient mentioned in the note
                properties:
                  age:
                    type: number
                    description: Patient age in years as a number, e.g. 45
                  gender:
                    type: string
                    description: Patient gender as stated or implied in the note
                  allergies:
                    type:
                      - array
                      - 'null'
                    description: List of documented allergies; null if none mentioned
                    items:
                      type: string
                      description: A single allergy (drug, food, or environmental)
                required:
                  - age
                  - gender
                  - allergies
              symptoms:
                type: array
                description: >-
                  Active symptoms the patient is currently experiencing or
                  reporting
                items:
                  type: string
                  description: A single symptom in plain language, e.g. 'chest pain'
              diagnosis:
                type: array
                description: >-
                  Only confirmed diagnoses — do not include suspected or
                  rule-out conditions
                items:
                  type: string
                  description: A single confirmed diagnosis
              severityLevel:
                type: string
                description: >-
                  Overall clinical severity based on the presenting condition
                  and vitals
                enum:
                  - mild
                  - moderate
                  - severe
                  - critical
              notes:
                type:
                  - string
                  - 'null'
                description: >-
                  Additional clinical notes, provider observations, or
                  contextual information not captured elsewhere
            required:
              - patientInfo
              - symptoms
              - diagnosis
              - severityLevel
              - notes
    TextToJsonResponse:
      type: object
      description: Response containing the structured JSON data extracted from text
      properties:
        data:
          type: object
          description: Extracted structured data that conforms to the provided schema
          example:
            patientInfo:
              age: 45
              gender: male
              allergies: null
            symptoms:
              - chest pain
            diagnosis: []
            severityLevel: moderate
            notes: null
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    accountIdAuth:
      type: apiKey
      in: header
      name: X-ACCOUNT-ID

````