Uploading Files to Formant Cloud

Formant offers the ability to store generic files on its servers. They can be uploaded via the web app, the Cloud SDK , or File API. These files can then be retrieved only via the File API.

To do so via the web app, navigate to "Settings" -> "Cloud Files." From here, you can upload any file. Formant will accept that file and return a File ID. You can now use this File ID with the query API where you'd like to retrieve it.

❗️

File ID

Once you are given a File ID, you will not be able to access it again. Be sure to save this in a safe place.

🚧

Once a file is uploaded to Formant, it is there permanently. Furthermore, you will not be able to see a list of files. Be sure to save the File ID from upload.

Once you have a file ID, pass it into the File API to retrieve it. Example:

import requests

FILE_ID = '0d29f656-cc1c-4b9e-baad'

url = "https://api.formant.io/v1/admin/files/query"

payload = {"fileIds": [FILE_ID]}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

"""
Response is of the form:
{
  "fileUrls": [
    "https://telemetry-prod-usw2-file-storage-service.s3.us-west-2.amazonaws.com/files/0d29f656-cc1c-4b9e-baad..."
  ]
}

"""