Saltar al contenido principal

Installation

Difference between SCAN INVOICE AND SCAN DOCUMENTS Scan Documents is used to scan any type of document and get any custom data, while Scan Invoice is used to scan only invoices.

What happens if you are not programming in javascript?

No problem, you can use the Totalum API directly, it is a REST API, so you can use it from any programming language.

Go to next steps to see how to use the Totalum API directly.

If you are programming in javascript, you can use the totalumSdk

Totalum SDK es un package de npm, compatible con nodejs y con navegadores.

https://www.npmjs.com/package/totalum-api-sdk


npm i totalum-api-sdk

Authentication

You can choose to use one of the two authentication methods offered by Totalum Sdk:

  • Token: You can use an access token to authenticate. This token can be obtained from the localStorage of your browser from the web https://web.totalum.app

  • ApiKey: (RECOMMENDED OPTION) You can use an ApiKey to authenticate. This ApiKey can be obtained in the Api Keys section of the Configuration section of Totalum.

ES Module Import:


import {AuthOptions, TotalumApiSdk} from 'totalum-api-sdk';

// CHOICE FROM USE accessToken OR apiKey (API KEY IS RECOMMENDED)

// the auth using token
const options: AuthOptions = {
token:{
accessToken: 'YOUR TOKEN' // get it from totalum project web localStorage
}
}

// the auth using api key
const options: AuthOptions = {
apiKey:{
'api-key': 'your_api_key', //the api key secret that is shown only once, example: sk-234fgrw4t3w...
}
}

const totalumClient = new TotalumApiSdk(options);

// execute some TotalumApiSdk function
const result = await totalumClient.crud.getItems('your_element_table_name', {});

CommonJS Require:


const totalum = require('totalum-api-sdk');

// CHOICE FROM USE accessToken OR apiKey (API KEY IS RECOMMENDED)

// the auth using token
const options = {
token:{
accessToken: 'YOUR TOKEN' // get it from totalum project web localStorage
}
}

// the auth using api key
const options = {
apiKey:{
'api-key': 'your_api_key', //the api key secret that is shown only once, example: sk-234fgrw4t3w...
}
}

const totalumClient = new totalum.TotalumApiSdk(options);

// execute some TotalumApiSdk function
const result = await totalumClient.crud.getItems('your_element_table_name', {});

HTML script import: (Use this way if you are using standalone html, and you cannot import npm packages)

<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/totalum-sdk.min.js"></script>
</head>
<script>
//Example of use TotalumSdk in your custom html page
const token=localStorage.getItem('token');
var totalumClient = new totalumSdk.TotalumApiSdk({
token:{
accessToken: token
}
});

const tableElementName = 'your-table-name'; // replace with your table name

//example of endpoint execution
const result = totalumClient.crud.getItems(tableElementName, {}).then((result) => {
const items = result.data.data;
console.log("THE ITEMS", items);
});

</script>

Si tienes dudas de como instalar y usar TotalumSdk mira la documentación aquí