Code Integration

The Coqnitics cloud API is REST-based and can be integrated easily into your system. You can make API calls in any programming language depending your needs.

Change the url and the keys that you have signed up to.

Note: For all APIs, the following image file types are accepted: jpg, jpeg or png.

Code Samples

Connect to the Coqnitics’s cloud API from the command line:


curl -H "Content-Type: multipart/form-data" \
-F "filename=@path/to/file" \
-F "access_key=YOUR_ACCESS_KEY" \
-F "secret_key=YOUR_SECRET_KEY" \


import requests # pip install requests
import json     # pip install json

# Path of image (jpg/jpeg/png)
file = "path/to/file"

# url name
url = ""
accessKey = "YOUR_ACCESS_KEY"
secretKey = "YOUR_SECRET_KEY"

# access_key and secret_key
data = {'access_key': accessKey,
  'secret_key': secretKey}

filename = {'filename': open(file,'rb')}
r =, files = filename, data=data)
content = json.loads(r.content)


require 'rest_client' # gem install rest-client

# url name
url = ""

# File path (jpg/jpeg/png)
file = "path/to/file"

# Access key and secret key
access_key = "YOUR_ACCESS_KEY"
secret_key = "YOUR_SECRET_KEY"

result =
    { :filename =>, "rb") ,
      :access_key => access_key,
      :secret_key => secret_key
  'Content-Type' => 'multipart/form-data',


function uploadFile() {
  var blobFile = $('#filechooser')[0].files[0];
  var formData = new FormData();

  // upload image through form (jpg/jpeg/png)
  formData.append("filename", blobFile);

  // change the access_key and secret_key here
  formData.append("access_key", "YOUR_ACCESS_KEY");
  formData.append("secret_key", "YOUR_SECRET_KEY");

  //To use Jquery, you can download it from
  //or include it from a CDN into your HTML.
     url: "",
     type: "POST",
     data: formData,
     processData: false,
     contentType: false,
     success: function(response) {
     error: function(jqXHR, textStatus, errorMessage) {
         console.log(errorMessage); // Optional