Skip to main content
POST
/
ner
/
files
/
uri
NER Files Uri
curl --request POST \
  --url https://api.private-ai.com/community/ner/files/uri \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "uri": "/home/azureuser/example-image.jpeg",
  "entity_detection": {
    "return_entity": true
  },
  "ocr_options": {
    "ocr_system": "azure_computer_vision"
  }
}
'
import requests

url = "https://api.private-ai.com/community/ner/files/uri"

payload = {
    "uri": "/home/azureuser/example-image.jpeg",
    "entity_detection": { "return_entity": True },
    "ocr_options": { "ocr_system": "azure_computer_vision" }
}
headers = {
    "x-api-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    uri: '/home/azureuser/example-image.jpeg',
    entity_detection: {return_entity: true},
    ocr_options: {ocr_system: 'azure_computer_vision'}
  })
};

fetch('https://api.private-ai.com/community/ner/files/uri', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.private-ai.com/community/ner/files/uri",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'uri' => '/home/azureuser/example-image.jpeg',
    'entity_detection' => [
        'return_entity' => true
    ],
    'ocr_options' => [
        'ocr_system' => 'azure_computer_vision'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "x-api-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.private-ai.com/community/ner/files/uri"

	payload := strings.NewReader("{\n  \"uri\": \"/home/azureuser/example-image.jpeg\",\n  \"entity_detection\": {\n    \"return_entity\": true\n  },\n  \"ocr_options\": {\n    \"ocr_system\": \"azure_computer_vision\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.private-ai.com/community/ner/files/uri")
  .header("x-api-key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"uri\": \"/home/azureuser/example-image.jpeg\",\n  \"entity_detection\": {\n    \"return_entity\": true\n  },\n  \"ocr_options\": {\n    \"ocr_system\": \"azure_computer_vision\"\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.private-ai.com/community/ner/files/uri")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"uri\": \"/home/azureuser/example-image.jpeg\",\n  \"entity_detection\": {\n    \"return_entity\": true\n  },\n  \"ocr_options\": {\n    \"ocr_system\": \"azure_computer_vision\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "entities": [
    {
      "text": "<string>",
      "location": {
        "stt_idx": 123,
        "end_idx": 123,
        "stt_idx_processed": 123,
        "end_idx_processed": 123
      },
      "label": "<string>",
      "likelihood": 123
    }
  ],
  "entities_present": true,
  "languages_detected": {},
  "characters_processed": 123,
  "objects": [
    {
      "location": {
        "page": 123,
        "x0": 0.5,
        "x1": 0.5,
        "y0": 0.5,
        "y1": 0.5
      }
    }
  ],
  "objects_present": false,
  "audio_duration": 123,
  "page_count": 123
}
{
  "detail": "<string>"
}
{
  "detail": "<string>"
}
{
  "detail": "<string>"
}

Authorizations

x-api-key
string
header
required

Body

application/json
uri
string
required

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
PIIDetectionParams · object

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.

object_entity_detection
ObjectEntityDetection · object

This section contains a set of parameters to control the object entity detection process. It allows the user to select the object entity types to detect (e.g., to detect FACE but not LICENSE_PLATE).

pdf_options
PDFOptions · object

Options to process PDF files, such as the rendering quality when each page is turned into an image.

office_options
OfficeOptions · object

Options to process Office files, such as table and chart behaviour.

image_options
ImageOptions · object

Options to process image files, such as the masking mode.

audio_options
AudioOptions · object

Options to process audio files, such as the padding to add while redacting audio segments.

project_id
string

Used to categorize requests for reporting purposes. Limited to alphanumeric characters or the following special characters :_-

Maximum string length: 60
Pattern: ^[a-zA-Z0-9\-_\:]*$
ocr_options
AWSTextractOCROptions · object

Options to provide Optical Character Recognition (OCR) details, such as choice of OCR system.

Response

Successful Response

entities
(NerFileEntityItem · object | NerOfficeFileEntityItem · object)[]
required

A list of all entities found in the provided file.

Empty

entities_present
boolean
required

Returns True if the list of detected entities is not empty.

languages_detected
Languages Detected · object
required

A dictionary containing ISO 639-1 language labels and the likelihood of their detection in the request payload.

characters_processed
integer
required

The number of characters extracted from the file.

objects
FileObjectEntityItem · object[]

A list of all object entities found in the provided file using object detection.

objects_present
boolean
default:false

Returns True if the list of detected objects is not empty.

audio_duration
number | null

The length of the audio file in seconds.

page_count
integer | null

The number of pages in the file.