Getting Started
Uploading a new file to Kontera and processing it as a document is a multi-step process.
- Get a signed URL to upload the file to
- Upload the file using a PUT to the signed URL
- Create a document from your uploaded file
Basic Example
const fs = require('fs')
const uploadFileResponse = await fetch('https://api.kontera.ch/api/public/v1/documents/file', {    method: 'POST',    headers: {        'Content-Type': 'application/json',        'Authorization': 'Bearer YOUR_ACCESS_TOKEN' // Make sure to be authorized    },    body: JSON.stringify({        fileName: 'example.pdf',        contentType: 'application/pdf'    })});
const uploadFileData = await uploadFileResponse.json();const { signedUrl, signedFileName } = uploadFileData;
// Now you can use the signed URL to upload your fileconst uploadResponse = await fetch(signedUrl, {    method: 'PUT',    headers: {        'Content-Type': 'application/pdf'    },    body: fs.createReadStream('example.pdf')});
// After the upload, make sure to create a new document using the signedFileNameconst createDocumentResponse = await fetch('https://api.kontera.ch/api/public/v1/documents', {    method: 'POST',    headers: {        'Content-Type': 'application/json',        'Authorization': 'Bearer YOUR_ACCESS_TOKEN' // Make sure to be authorized    },    body: JSON.stringify({        signedFileName: signedFileName,        fileName: 'example.pdf',        processImmediately: true    })});