POST - Upload JSON
post
Optional upload endpoint that allows uploading files as base64 in an application/json payload.
Please supply a valid bearerToken
and products
or fieldSet
or fieldSets
.
Authorizations
Body
tagsstring[]Optional
tags associated with your file
productsstring[]Optional
Array of products to predict on. Cannot be supplied with fieldSet or fieldSets
fieldSetstringOptional
A single field set for extraction
fieldSetsstring[]Optional
Optionally use this parameter to extract an array of field sets. Needs to be a json array in a string.
Responses
200
File was successfully uploaded.
application/json
default
Error
application/json
post
import requests
import base64
import json
url = 'https://api.sypht.com/fileupload/json'
payload = {'fieldSets': ["sypht.invoice","sypht.document"],
'file':{'name':{{name of file}},'base64':base64.b64encode(open({{path to file}},'rb').read())}}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer '+token
}
response = requests.request('POST', url, headers = headers, data = json.dumps(payload), allow_redirects = False)
print(response.text)
{
"fileId": "text",
"uploadedAt": "text",
"status": "text"
}
Last updated
Was this helpful?