File upload via api

Hi, is it possible to upload a file via API, to contacts / deals / tasks?

Any update on this question?

Tried to recreate calls that are invoked by AC Web Portal for adding a file to a deal but I am getting the Internal Sever Error

The web portal is adding a file by making two calls to:
https://deals-file-attachments.cluster.app-us1.com/files
The first call is OPTIONS call the second call is a POST call with multipart data using the web site authorisation token in the headers.
Getting past the authorization successfully but getting the Internal Server Error, 500.

Anyone had success doing this?