How do I get the Nanonets API working?

Nanonets is API first provider and our API is very straightforward to use.



1. Go to your Model

To start using the API you need to have a model first. What is a Model, a Model is the workflow that you setup with Nanonets to extract data from your files.

If you already have a model great just navigate to your models Extract Data screen. If you haven't yet created a model, go to https://app.nanonets.com and select your document type and create your first model.


2. Go to the Integrate Screen

On your model screen go to the integrate screen.


3. Pick options

Select your programing language of choice and if you would like to send a file via Url or a local file directly from your system


4. Click Copy Code

Click Copy Code to get the code to use to query the API. Paste it into your favorite text editor and run.


5. How to setup Authentication correctly with Nanonets

Nanonets uses "Basic Authentication" for Authenticating that it is indeed an authorised user making a API request.

In the Basic Authentication schema we use the API Key that can be found here: API Keys as the "username" and the "password" is set to blank. Below are sample using Curl, Postman and Python

Curl

Here is what a sample curl request looks like to get all your OCR models:

curl --user YOUR_API_KEY: https://app.nanonets.com/api/v2/OCR/Models/

Please note that there is a ":" at the end this is split the username and password, but since the password is blank there is nothing following the ":". This is only for Curl example and doesn't apply to the examples below.

Postman

You need to go the Authorization tab and enter your API Key in the Username. The password is blank. The API Key is pasted as is without any modification or any other characters before or after

Python

import requests
url = "https://app.nanonets.com/api/v2/OCR/Models/"
payload = {}
response = requests.request("GET", url, data = payload, auth=('YOUR_API_KEY', ''))
print(response.text.encode('utf8'))

Replace your API Key in the code. The API Key is pasted as is without any modification or any other characters before or after


Was this article helpful?