Skip to main content

AIDA API input

AIDA allows you to upload a document directly via the API input. Integration is handled with the <integration_key> generated by AIDA.

Optionally, you can pass a map of key/values for property values that AIDA will read. Each "key" of the map can either be the property label itself, or the "input/output mapping" value configured.

The following is an example call for cURL:

curl -X POST -H "Content-Type: multipart/form-data" -F "file=@/path/to/your/file" -F "sampleLabel1=sampleValue1" -F "sampleLabel2=sampleValue2" "https://api.aidacloud.com/api/v1/upload/direct/<integration_key>"

The following is an example call for PHP language:

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aidacloud.com/api/v1/upload/direct/<integration_key>");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);

// If using PHP 5.5 or higher, use CURLFile for file uploads.
// For PHP versions below 5.5, the deprecated @file syntax can be used.
$file = new CURLFile('path/to/your/yourfile.pdf', 'application/pdf', 'yourfile.pdf');

$postFields = array(
'file' => $file,
'sampleLabel1' => 'sampleValue1',
'sampleLabel2' => 'sampleValue2'
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
$json_response = curl_exec($curl);
curl_close($curl);

The following is an example call for Javascript language, using axios library:

const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');

async function uploadFile(filePath) {
const formData = new FormData();
formData.append('file', fs.createReadStream(filePath));
formData.append('sampleLabel1', 'sampleValue1');
formData.append('sampleLabel2', 'sampleValue2');

try {
const response = await axios.post('https://api.aidacloud.com/api/v1/upload/direct/<integration_key>', formData, {
headers: {
...formData.getHeaders()
}
});
console.log(response.data);
} catch (error) {
console.error(`Error uploading file: ${error}`);
}
}

const filePath = '/path/to/your/file';
uploadFile(filePath);