Docs upload via API
The ToothFairyAI platform allows for the programmatic upload of documents. This is done via two separate api calls to decouple the document upload from the document processing. This allows for the upload of documents to be done in a batch process, and the categorisation and processing of documents to be done in a separate process.
Preparation
Retrieve the workspace token and the workspace id under the section API integrations in the Admin section. ToothFairyAI will show both the workspace token and the workspace id. The workspace token is used to authenticate the upload of documents, and the workspace id is used to identify the workspace to which the documents should be uploaded. Do not share the workspace token with anyone as this will allow anyone to upload documents to your workspace.
Get pre-signed url
We allow users to upload documents using a pre-signed URL to safely store files into our platform - see how
Upload file
Using the pre-signed URL, upload the file to our platform using the programming language of your choice. The url will be valid for 5 minutes, after which it will expire. If the url expires, you will need to request a new url.
The filename parameter must adhere to the following format: workspaceid/filename
The filename
should be unique for each document uploaded to the platform otherwise the document will be overwritten.
Create document
Once the file has been uploaded, the requestUploadURL
will return a filePath which is the path to the file on our platform.
Use this path to link the file to a new document on our platform - see how
Well done 🎉
You have successfully uploaded a document to our platform.
What's next?
The document will now be processed and categorised if the status of the document is set to published
upon creation or update see how.
You can check the status of the document by using the getDocument
endpoint - see how