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

# Process Files Uri

> Detect entities such as PII, PHI or PCI in the file located at the provided URI using Private AI's entity detection engine. After entity detection, a copy of the file with all entities removed is created and placed in the folder specified by `PAI_OUTPUT_FILE_DIR` on the local host.

This route is similar to `/v3/process/files/base64`, but relies on URIs instead of base64-encoded strings. As this route avoids the overhead of base64 encoding, it is more suitable for processing large files and large volumes of data.

This route supports the following content types: application/json, application/msword, application/pdf, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/xml, message/rfc822, text/csv, text/plain, jpeg, jpeg, tiff, tiff, png, bmp, bmp, mp4, m4a, m4a, mp3, mp3, wav, wav



## OpenAPI

````yaml /openapi/privateai_3.3.3.json post /v3/process/files/uri
openapi: 3.0.2
info:
  title: API Reference
  description: Private AI API Reference
  termsOfService: https://www.private-ai.com/terms-of-use/
  contact:
    url: https://www.private-ai.com/contact/
    email: info@private-ai.com
  version: 3.3.3
servers:
  - url: https://api.private-ai.com/deid
    description: Private AI Demo Server
  - url: http://localhost:8080
    description: Local Server
security: []
paths:
  /v3/process/files/uri:
    post:
      summary: Process Files Uri
      description: >-
        Detect entities such as PII, PHI or PCI in the file located at the
        provided URI using Private AI's entity detection engine. After entity
        detection, a copy of the file with all entities removed is created and
        placed in the folder specified by `PAI_OUTPUT_FILE_DIR` on the local
        host.


        This route is similar to `/v3/process/files/base64`, but relies on URIs
        instead of base64-encoded strings. As this route avoids the overhead of
        base64 encoding, it is more suitable for processing large files and
        large volumes of data.


        This route supports the following content types: application/json,
        application/msword, application/pdf, application/vnd.ms-excel,
        application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
        application/vnd.openxmlformats-officedocument.wordprocessingml.document,
        application/xml, message/rfc822, text/csv, text/plain, jpeg, jpeg, tiff,
        tiff, png, bmp, bmp, mp4, m4a, m4a, mp3, mp3, wav, wav
      operationId: process_files_uri_v3_process_files_uri_post
      parameters:
        - required: false
          schema:
            title: X-Api-Key
            type: string
            default: ''
          name: x-api-key
          in: header
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProcessFileRequest'
            examples:
              process_files:
                summary: Process File with uri payload
                value:
                  uri: /home/azureuser/example-image.jpeg
                  entity_detection:
                    accuracy: high
                    return_entity: true
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProcessFileResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ProcessFileRequest:
      title: ProcessFileRequest
      required:
        - uri
      type: object
      properties:
        uri:
          title: Uri
          type: string
          description: >-
            URI of the file to be processed. It must be an accessible file path
            on the host machine (e.g. /Users/sam/files/file.pdf).
        entity_detection:
          title: Entity Detection
          allOf:
            - $ref: '#/components/schemas/PIIDetectionParams'
          description: >-
            This section contains a set of parameters to control the PII
            detection process. All fields have sensible default that can be
            changed for specific needs.
        pdf_options:
          title: Pdf Options
          allOf:
            - $ref: '#/components/schemas/PDFOptions'
          description: >-
            Options to process PDF files, such as the rendering quality when
            each page is turned into an image.
        audio_options:
          title: Audio Options
          allOf:
            - $ref: '#/components/schemas/AudioOptions'
          description: >-
            Options to process audio files, such as the padding to add while
            redacting audio segments.
        project_id:
          title: Project Id
          maxLength: 32
          pattern: ^[a-zA-Z0-9\-_\:]*$
          type: string
          description: >-
            Used to categorize requests for reporting purposes. Limited to
            alphanumeric characters or the following special characters :_-
      additionalProperties: false
    ProcessFileResponse:
      title: ProcessFileResponse
      required:
        - result_uri
        - processed_text
        - entities
        - entities_present
      type: object
      properties:
        result_uri:
          title: Result Uri
          type: string
          description: >-
            URI of the processed file in the output directory (e.g.
            /Users/sam/files/file.redacted.pdf).
        processed_text:
          title: Processed Text
          type: string
          description: >-
            This field contains the redacted version of any text that was
            extracted from the input file. It corresponds to a redacted ASR
            transcript for audio files and any text found inside a document such
            as a PDF or image file.
        entities:
          title: Entities
          type: array
          items:
            $ref: '#/components/schemas/FileEntityItem'
          description: A list of all entities found in the provided file.
        entities_present:
          title: Entities Present
          type: boolean
          description: Returns `True` if the list of detected entities is not empty.
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    PIIDetectionParams:
      title: PIIDetectionParams
      type: object
      properties:
        accuracy:
          allOf:
            - $ref: '#/components/schemas/AccuracyMode'
          description: >-
            Selects the model used to identify PII in the input text. By
            default, the `high` accuracy model is used. While the models used by
            the Private AI solution are highly optimized (~25X faster than a
            reference transformer implementation), in high-throughput cases it
            is possible to trade accuracy for speed by selecting either the
            `standard` or `standard_high` accuracy modes. Multilingual support
            can be enabled by using one of the multilingual models, namely
            `standard_high_multilingual` (GPU container only) and
            `high_multilingual`. The multilingual models process all supported
            languages including English, without the need to specify language.
            It is advisable to use the English-only models where possible, as
            they perform slightly better on English.
          default: high
        entity_types:
          title: Entity Types
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/EnableEntityTypeSelector'
              - $ref: '#/components/schemas/DisableEntityTypeSelector'
          description: >-
            Controls which entity types and legislation sets are detected. See
            [Supported Entity
            Types](https://docs.private-ai.com/entities/#supported-entities) for
            the list of possible entities and legislation sets. By default, all
            entities are detected and removed. You can specify one of many
            selectors, which can be either an individual entity type such as
            `LOCATION_CITY` or a legislation like `GDPR`.
            `EnableEntityTypeSelector` selectors will add entity types to
            detect. On the contrary, `DisableEntityTypeSelector` selectors will
            ignore entities of the specified types. If only
            `DisableEntityTypeSelector` selectors are specified, they are
            assumed to be ignoring entity types from the entire supported list
            of entity types.
        filter:
          title: Filter
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/AllowFilter'
              - $ref: '#/components/schemas/BlockFilter'
          description: >-
            Allows the user to customize PII detection via allow and block
            lists. See [Supported Entity
            Types](https://docs.private-ai.com/entities/#supported-entities) for
            the list of possible entities.
        return_entity:
          title: Return Entity
          type: boolean
          description: >-
            Controls whether the PII list in the response contains the `text`
            field. Turning this off means that no sensitive PII is returned in
            the response.
          default: true
        override:
          title: Override
          type: boolean
          description: >-
            Determines whether the disabled entity is used to override any other
            entities that the PII might belong to. Using this will force the
            system to keep a detected PII in the text.
          default: false
      additionalProperties: false
    PDFOptions:
      title: PDFOptions
      type: object
      properties:
        density:
          title: Density
          type: integer
          description: >-
            PDFs are converted into images using this DPI value. Smaller values
            result in images with smaller resolutions, which will take up less
            storage space and process faster, at the cost of output quality &
            redaction accuracy.
          default: 200
        max_resolution:
          title: Max Resolution
          type: integer
          description: >-
            PDFs are converted into images using the `density` DPI value. Any
            resulting images with maximum size length larger than this will be
            resized to this value, while preserving aspect ratio.
          default: 3000
      additionalProperties: false
    AudioOptions:
      title: AudioOptions
      type: object
      properties:
        bleep_start_padding:
          title: Bleep Start Padding
          minimum: 0
          type: number
          description: Additional padding at the start of bleep, in seconds.
          default: 0
        bleep_end_padding:
          title: Bleep End Padding
          minimum: 0
          type: number
          description: Additional padding at the end of bleep, in seconds.
          default: 0
      additionalProperties: false
    FileEntityItem:
      title: FileEntityItem
      required:
        - processed_text
        - text
        - location
        - best_label
        - labels
      type: object
      properties:
        processed_text:
          title: Processed Text
          type: string
          description: >-
            The corresponding marker in the de-identified text (result field),
            where the entity exists. Note that this field is only populated for
            text-based formats such as `.txt`
        text:
          title: Text
          type: string
          description: >-
            The text corresponding to the entity. For images the text is
            obtained using OCR, while for audio the text is obtained using ASR.
        location:
          title: Location
          anyOf:
            - $ref: '#/components/schemas/TextLocation'
            - $ref: '#/components/schemas/ImageLocation'
            - $ref: '#/components/schemas/AudioLocation'
        best_label:
          title: Best Label
          type: string
          description: The entity label with the highest likelihood.
        labels:
          title: Labels
          type: object
          additionalProperties:
            type: number
          description: >-
            A dictionary of all possible labels, together with associated
            likelihoods. Note that these are not strictly probabilities and do
            not sum to 1, as a word can belong to multiple classes. The scores
            have also been thresholded, so no additional thresholding is
            necessary.
      description: Empty
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
    AccuracyMode:
      title: AccuracyMode
      enum:
        - standard
        - standard_high
        - standard_high_multilingual
        - high
        - high_multilingual
      type: string
      description: >-
        Selects the model used to identify PII in the input text. By default,
        the "high" accuracy model is used. While the models used by the Private
        AI solution are highly optimized (~25X faster than a reference
        transformer implementation), in high-throughput cases it is possible to
        trade accuracy for speed by selecting either the "standard" or
        "standard_high" accuracy modes. Multilingual support can be enabled by
        using one of the multilingual models, namely
        "standard_high_multilingual" (GPU container only) and
        "high_multilingual". The multilingual models process all supported
        languages including English, without the need to specify language. It is
        advisable to use the English-only models where possible, as they perform
        slightly better on English.
    EnableEntityTypeSelector:
      title: EnableEntityTypeSelector
      type: object
      properties:
        type:
          title: Type
          enum:
            - ENABLE
          type: string
          default: ENABLE
        value:
          title: Value
          type: array
          items:
            type: string
          description: >-
            A list of entity types to detect and remove. See [Supported Entity
            Types](https://docs.private-ai.com/entities/#supported-entities) for
            a complete list of entity types. This can also be one or many
            legislations. We currently support these legislations  ['GDPR',
            'GDPR_SENSITIVE', 'HIPAA', 'CPRA', 'QUEBEC_PRIVACY_ACT', 'PCI',
            'APPI', 'APPI_SENSITIVE', 'LIDI'].
      additionalProperties: false
    DisableEntityTypeSelector:
      title: DisableEntityTypeSelector
      type: object
      properties:
        type:
          title: Type
          enum:
            - DISABLE
          type: string
          default: DISABLE
        value:
          title: Value
          type: array
          items:
            type: string
          description: >-
            A list of entity types to ignore. See [Supported Entity
            Types](https://docs.private-ai.com/entities/#supported-entities) for
            a complete list of entity types.
      additionalProperties: false
    AllowFilter:
      title: AllowFilter
      required:
        - pattern
      type: object
      properties:
        type:
          title: Type
          enum:
            - ALLOW
          type: string
          description: >-
            Any entities in this list that match the regex pattern provided will
            be discarded. It is also possible to set this option via environment
            variable. See [Environment
            Variables](https://docs.private-ai.com/environment-variables)
          default: ALLOW
        pattern:
          title: Pattern
          type: string
          description: >-
            Any string matching this regex pattern will not be caught by the PII
            detection algorithm.
      additionalProperties: false
    BlockFilter:
      title: BlockFilter
      required:
        - entity_type
        - pattern
      type: object
      properties:
        type:
          title: Type
          enum:
            - BLOCK
          type: string
          description: >-
            The block feature allows you to extend the functionality of the
            Private AI models by using regular expressions. This way, you can
            define a Python regex pattern that will be used to identify
            additional tokens with the given PII label.


            Several block list filters can be specified with their own regex
            pattern.


            Lastly,for supported labels, if you would like the model to pick up
            only the tokens from the block list, you can use the enabled entity
            type feature together with the block list feature. This can be done
            by defining a list of enabled entity types and not including the
            supported label you are adding to the block list. For example, if
            you would like the label `ORGANIZATION` to only pick up Microsoft,
            you can define the enabled entity types as `[{"type":"ENABLE",
            "value": "NAME"}, {"type": "ENABLE", "value": "LOCATION"}, {"type":
            "ENABLE", "value": "AGE"}, ...]` (and omitting `ORGANIZATION`) and
            the block list as `[{"type": "BLOCK", "entitiy_type":
            "ORGANIZATION", "pattern": "Microsoft"}]`.
          default: BLOCK
        entity_type:
          title: Entity Type
          type: string
          description: >-
            Name of the custom entity type. It can either be a completely new
            entity type such as `CUSTOM_ID` or an existing entity, such as
            `NAME`.
        pattern:
          title: Pattern
          type: string
          description: >-
            This is a pattern to match in the text. This feature uses regex
            patterns, you can either pass a word (e.g. the, word, custom, etc.)
            or you can pass a valid Python regex pattern. It is important to
            note that regex patterns may require escaping when used in JSON
            objects. To give an example, if you would like to send the regex
            pattern `r"\b\w{4}\b"` which will catch every 4-character word, you
            need to send it as `"\\b\\w{4}\\b"`. A complete JSON grammar is
            found here: https://www.json.org/json-en.html. More information on
            how to write a python regex is found here:
            https://docs.python.org/3/library/re.html


            It is important to note also that only non-overlapping matches are
            returned.
        threshold:
          title: Threshold
          type: number
          description: >-
            This is defining a likelihood threshold for custom entity. This
            likelihood is compared against the predicted model likelihood and if
            it is greater then the custom entity is outputted instead of the
            model predicted entity. By default this threshold is set to 1.0
            which will ensure that the blocked entities will always be preferred
            over a matching model predicted entity. This can be any value
            between 0 and 1.
          default: 1
      additionalProperties: false
    TextLocation:
      title: TextLocation
      required:
        - stt_idx
        - end_idx
        - stt_idx_processed
        - end_idx_processed
      type: object
      properties:
        stt_idx:
          title: Stt Idx
          type: integer
          description: Start character index of the entity in the original text.
        end_idx:
          title: End Idx
          type: integer
          description: >-
            Index of the character immediately following the entity, such that
            end_idx - stt_idx = number of characters in the entity.
        stt_idx_processed:
          title: Stt Idx Processed
          type: integer
          description: Start character index of the entity in the processed text.
        end_idx_processed:
          title: End Idx Processed
          type: integer
          description: >-
            Index of the character immediately following the entity in the
            processed text.
      description: >-
        Start and end indices of the entity in a text-based file format such as
        `.txt`.
    ImageLocation:
      title: ImageLocation
      required:
        - page
        - x0
        - x1
        - y0
        - y1
      type: object
      properties:
        page:
          title: Page
          type: integer
          description: >-
            The page or layer that the entity occurs on. This corresponds to
            page in a PDF document or layer in a TIFF image.
        x0:
          title: X0
          type: number
          description: X coordinate of the upper left point of the entity bounding box.
        x1:
          title: X1
          type: number
          description: X coordinate of the lower right point of the entity bounding box.
        y0:
          title: Y0
          type: number
          description: Y coordinate of the upper left point of the entity bounding box.
        y1:
          title: Y1
          type: number
          description: Y coordinate of the lower right point of the entity bounding box.
      description: >-
        Bounding box of the entity in an image or PDF file (PDF files are
        converted to images). The origin is the upper left pixel of the image.
        Coordinates are given as a fraction of the X and Y image dimensions.
    AudioLocation:
      title: AudioLocation
      required:
        - stt_time
        - end_time
      type: object
      properties:
        stt_time:
          title: Stt Time
          type: number
          description: The start timestamp of the entity, in seconds
        end_time:
          title: End Time
          type: number
          description: The end timestamp of the entity, in seconds
      description: Timestamp of the entity in an audio file such as `.wav`.

````