Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

Required scopes
This endpoint requires the following scopes:
  • : Provides access to Fileupload Service
  • : upload document
Authorizations
OAuth2clientCredentialsRequired

We use an Oauth2 authentication flow. Users can create a client_id and client_secret upon signing up with Sypht. Use these to generate your reusable bearer token, which must be included in the Authorization header of each request. You can store and reuse these tokens for up to an hour.

To get a token you need to POST to the tokenUrl with the client_id and grant_type in the request body and colon separated, base64 encoded client_id and client_secret in a basic Authorization header. For example Basic {Base64(client_id:client_secret)}

Token URL:
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
fileIdstringOptional

The unique identifier associated to this file and request.

uploadedAtstringOptional
statusstringOptional
post/fileupload/json
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": "30d3e543-47c8-42e6-a6f6-40c50d199395",
  "uploadedAt": "2018-05-15T04:23:14.027Z",
  "status": "RECEIVED"
}

Last updated