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.

The following is an example call for cURL:

curl -X POST -H "Content-Type: multipart/form-data" -F "file=@/path/to/your/file" "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);
curl_setopt($curl, CURLOPT_POSTFIELDS, array('file' => '@' . <path_to_file>));
$json_response = curl_exec($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));

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);