Laigo Docs
  • GET STARTED
    • Welcome to smartTools
    • Setup your Account
    • Make your first Request
    • Smart Table Extraction
  • smartTools API
    • smartICR
    • smartClassify
    • smartInvoice
    • smartReceipt
    • smartTableExtraction
    • smartPaperFlow
    • Results
    • Delete
  • Tools
    • Laigo Postman
    • Laigo SDK
  • Account
    • My Account
Powered by GitBook
On this page
  • Expected response
  • Uploading a new document
  • Upload file to smartICR
  1. GET STARTED

Make your first Request

PreviousSetup your AccountNextSmart Table Extraction

Last updated 5 months ago

Get your token

  1. Before you can use any of the APIs, you need to log in to your Laigo account or, if you don’t have one,

  2. For creating the token, please visit our and go to Administration- API Keys page to create and copy your client credentials.

  1. Once you logged in, then you can start to create your client secret and client id by selecting the API page on the left sidebar of the dashboard.

  1. For generating your client_id and client_secret you must fill the 'API Client Friendly Name' then click on the button ‘Generate’. The credentials that you can use for creating a token are now available.

  1. Create an access token. To request access tokens, an application must make a POST request with the following multipart form data to the token URI: grant_type=client_credentials.

The application must pass basic HTTP auth credentials using the client_id as the user and client_secret as the password access tokens are obtained by calling the https://account.laigo.io/realms/SmartTools/protocol/openid-connect/token endpoint, and the required secrets are available in the API tab for your need.

Create an access token


POST https://account.laigo.io/realms/SmartTools/protocol/openid-connect/token

Query Parameters

Name
Type
Description

client_id*

String

The ClientId that has been generated for this function.

client_secret*

String

The ClientSecret that has been generated for this function.

grant_type*

String

Here you put your client credentials


Get your sample code

curl -X POST "https://account.laigo.io/realms/SmartTools/protocol/openid-connect/token" \
     -d "client_id=<clientId>" \
     -d "client_secret=<clientSecret>" \
     -d "grant_type=client_credentials"
string tokenUrl = "https://account.laigo.io/realms/SmartTools/protocol/openid-connect/token";
using (HttpClient client = new HttpClient())
{
    var formData = new List<KeyValuePair<string, string>>
            {
                new KeyValuePair<string, string>("client_id", "<client_id>"),
                new KeyValuePair<string, string>("client_secret", "<client_secret>"),
                new KeyValuePair<string, string>("grant_type", "client_credentials")
            };

    var response = await client.PostAsync(tokenUrl, new FormUrlEncodedContent(formData));
    string responseContent = await response.Content.ReadAsStringAsync();

    Console.WriteLine(responseContent);
}
import requests

token_url = 'https://account.laigo.io/realms/SmartTools/protocol/openid-connect/token'
data = {'client_id': '<clientId>', 'client_secret': '<clientSecret>', 'grant_type': 'client_credentials'}

result = requests.post(token_url, data = data)
print(result.text)

Expected response

{
   "access_token":"USVb1nGO9kwQlhNRRnI4iWVy2UV5j7M6h7",
   "expires_in":300,
   "refresh_expires_in":0,
   "token_type":"Bearer",
   "not-before-policy":0,
   "scope":"smarttools:accounting smarttools:consumption"
}

Uploading a new document

Once your access tokens are obtained by following the steps shown above the required secrets are available in the API tab for your task. In our example we will show how to use the API call to the smartICR tool. First you have to make a POST request to the following route, since you are uploading a new document.

Upload file to smartICR

POST https://use.laigo.io/api/FileUpload/v1/Upload/smartICR

Query Parameters

Name
Type
Description

email*

String

If you want to sent the result to your email, you can define the destination email with this parameter

outputFormats*

String

As output format you can choose PDF and/ TEXT (e.g. outputFormats=PDF,TEXT)

languageHint

String

If you prefer the detection in a special language, you can force to use a language. Default Language is English. For choosing a Language, use the ISO-Langauge Code – 639-1

Headers

Name
Type
Description

accessToken*

String

A JWT issued to your application by the Laigo identity provider.

Request Body

Name
Type
Description

file*

String

The file for uploading

create a new one.
platform