Nanonets employs API key-based authentication to ensure secure access to the API. Every API request must include an API key, which serves as the primary method for client-side authentication. When you register for an account, you will automatically receive your first API key. To sign up and obtain your key, please follow this link.

Additionally, you have the capability to generate more API keys as needed and delete any existing ones. This is particularly useful for rotating your keys periodically to enhance security.

Including the API Key in Requests
All API requests must include your API key in the request header to ensure secure access. The header should be formatted as follows:

Authorization: 54282cbb-d030-11ee-9b3f-de54ff261286

HTTPS Requirement:

  • Secure Communication: All communications with the Nanonets API must occur over HTTPS, ensuring that data transmitted is encrypted and secure from interception.
  • Enforcement: Attempts to connect to the API over HTTP will be automatically rejected.

Managing API Key:

  1. Navigate to the left panel of the "Extract Data" screen and click on "Account Info".
  2. Under the "Account Info" section, click on "API Keys".
  1. On this page, click on the "Add a New Key" button.

Sample Request:

cURL with Basic Authentication

Use Basic Authentication to pass the API key as a username with an empty password:

curl -X GET 'https://app.nanonets.com/v2/' \
-u 'YOUR_API_KEY:' \
-H 'Content-Type: application/json'

Python Requests

Using the Python requests library, you can include the API key in the headers:

import requests

url = 'https://app.nanonets.com/v2/'
api_key = "YOUR_API_KEY"

response = requests.request('GET', url, auth=requests.auth.HTTPBasicAuth(api_key,''))

all_data = response.json()

Postman

In Postman, authenticate API requests using Basic Authentication by following these steps:

  1. Open a new request tab and enter the API URL.
  2. Go to the Authorization tab.
  3. Select Basic Auth from the Type dropdown.
  4. Enter your API key in the Username field and leave the Password field empty.
  5. Ensure that the URL starts with https:// to maintain secure communication over HTTPS.

🚧

Security Recommendations:

  • Keep your API key secure. Avoid exposing it in publicly accessible areas such as GitHub, client-side code, etc.
  • Regenerate your API key if you believe it has been exposed or compromised

Postman collection variables: https://learning.postman.com/docs/postman/variables-and-environments/variables/#defining-collection-variables