Upload and Extract (v2)
Upload documents and run workflows with more optionality
Last updated
Upload documents and run workflows with more optionality
Last updated
V2 of the Sypht API has been designed to offer users greater flexibility and more functionality by decoupling the file upload and workflow requests, allowing users to run one or more workflows on a single document.
Making a prediction to extract data via the Sypht API has two basic steps:
Upload a document
Invoke a workflow
Retrieve the results (optional - if the workflow has been invoked asynchronously)
File upload requests return a fileId
which will be used to refer to that file in subsequent requests to invoke workflows or retrieve results.
Workflow requests are asynchronous and work by placing the workflow request into a queue for later processing. After invoking the workflow you can poll the results endpoint and will receive results once the workflow is complete and the results have been finalised.
This guide will demonstrate how to make uploads and predictions using API calls in Postman. Please see our provided clients to do this programmatically.
Request headers
Content-Type = multipart/form-data
Accept= application/json
Authorization= Bearer {{access token}}
Request Payload
file
: binary of a PDF, PNG or JPG to extract fields from. Maximum file size supported is 20Mb with maximum page limit of 16. Limits can be adjusted on request.
Response
The fileId
in the response is the unique identifier used for the uploaded document which will be used to identify the document in future api requests.
The invoke workflow endpoint places your workflow request onto a queue for later processing. The results will be available via the results endpoint in a matter of seconds.
Request headers
Content-Type = application/json
Accept= application/json
Authorization= Bearer {{access token}}
Parameters
workflowId
: the id of the workflow, can be one of the default sypht workflows or a custom workflow we have tailored to your use case. Default workflow ids are sypht.ingest
, sypht.extract
, sypht.split
or sypht.validate
Request body
The request body depends on the workflow being invoked. Some workflows will require their own workflow specific inputs inputs, below is an example of the request body for the sypht.extract workflow. Further information is in later sections regarding v2 workflows.
Response body
After submitting a /fileupload/ request, the extraction request is queued asynchronously and results can be retrieved via a GET request to /results/<fileId> with the fileId found in the response.
For the above example, a GET request to api.sypht.com/result/final/f15ead36-dd97-4e1e-8db8-cad0fb9f5e07
In the response json, extractions are returned under results > fields for each of the fields in the AI product selected in the request (see marketplace for details of each field).
To help you get started we have put together a simple postman collection to demonstrate the process of uploading a file, running the sypht.extract workflow on the file and then checking for results.
Once you have imported the collection, you simply need to set up an environment with your API credentials (client id and client secret). You can find your credentials in the sypht app.