Experiment with the samples below to test our language capabilities. If you like what you see, let’s set up a personalised demo with your own documents
import requests
url = "https://app.nanonets.com/api/v2/OCR/Model/"
payload = "{\"categories\" : [\"category1\", \"category2\"], \"model_type\": \"ocr\"}"
headers = {
'Content-Type': "application/json",
}
response = requests.request("POST", url, headers=headers, auth=requests.auth.HTTPBasicAuth('REPLACE_API_KEY', ''), data=payload)
print(response.text)
Go to API documentation1var request = require('request')
2const form_data = {'categories' : ['category1', 'category2'], 'model_type': 'ocr'}
3const options = {
4 url : 'https://app.nanonets.com/api/v2/OCR/Model/',
5 body: JSON.stringify(form_data),
6 headers: {
7 'Authorization' : 'Basic ' + Buffer.from('REPLACE_API_KEY' + ':').toString('base64'),
8 'Content-Type': "application/json",
9 }
10}
11request.post(options, function(err, httpResponse, body) {
12
13 console.log(body)
14});
15
var client = new RestClient("https://app.nanonets.com/api/v2/OCR/Model/");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Basic REPLACE_API_KEY");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{"categories" :["category1", "category2"], "model_type": "ocr"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
curl -X POST https://app.nanonets.com/api/v2/OCR/Model/ \
-H 'Content-Type: application/json' \
-u 'REPLACE_API_KEY' \
-d '{"categories" : ["category1", "category2"], "model_type": "ocr"}'
{
"categories": [
"{{category1}}",
"{{category2}}"
],
"model_type": [
"ocr"
]
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
url := "https://app.nanonets.com/api/v2/OCR/Model/"
payload := strings.NewReader("{\"categories\" : [\"category1\", \"category2\"], \"model_type\": \"ocr\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.SetBasicAuth("REPLACE_API_KEY", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
var data = JSON.stringify({
"categories": [
"category1",
"category2"
],
"model_type": "ocr"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://app.nanonets.com/api/v2/OCR/Model/");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("authorization", "Basic " + btoa("REPLACE_API_KEY:"));
xhr.send(data);
require 'uri'
require 'net/http'
url = URI("https://app.nanonets.com/api/v2/OCR/Model/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.basic_auth 'REPLACE_API_KEY', ''
request.body = "{\"categories\" :[\"category1\", \"category2\"], \"model_type\": \"ocr\"}"
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"categories" : ["category1", "category2"], "model_type": "ocr"}");
Request request = new Request.Builder()
.url("https://app.nanonets.com/api/v2/OCR/Model/")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", Credentials.basic("REPLACE_API_KEY", ""))
.build();
Response response = client.newCall(request).execute();
Once you sign up with a business email, click on My Account > API Keys to get your key. This key will allow you to authenticate API requests.
Upload your own documents and test our pre-trained AI OCR models. Get a firsthand look at how it works on your own documents.
Automate data capture from any document with Nanonets’ AI-powered document OCR & machine learning. Extract data from documents & automate workflows for related use cases.