Create a File

Files can be uploaded to the API by creating a File object.

Create a File (via upload)

Accepted file formats are listed below. The content type must be specified in the Content-Type header.

File FormatContent Type
GIFimage/gif
JPEGimage/jpeg
Microsoft Word, .docapplication/msword
Microsoft Word (OpenXML), .docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
Microsoft Excel, .xmlapplication/vnd.ms-excel
Microsoft Excel (OpenXML), .xlsxapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
PDFapplication/pdf
PNGimage/png
Texttext/plain
TIFFimage/tiff
Definition
POST https://api.treasuryprime.com/file
ParameterTypeRequired?Description
filebinaryRequiredFile to be uploaded.
Example Request
$ cat myimage.jpg | curl -u $API_KEY_ID:$API_SECRET_KEY \
    -H 'Content-Type: image/jpeg' \
    -X POST \
    -T - https://api.treasuryprime.com/file
Example Response
{
  "content_hash": "95141e22e6d74d9cedc6b063c6a57cbbf80d9f06",
  "content_length": 16526,
  "content_type": "image/jpeg",
  "content_url": null,
  "created_at": "2019-03-25T21:31:50Z",
  "id": "file_0123456789",
  "updated_at": "2019-03-25T21:31:50Z"
}