Salesforce Sales Cloud - How do I attach a file to an opportunity in Salesforce using the Cloud Elements API?

To do this, use the POST /{objectName}/{objectId}/attachments API where the objectName would be Opportunity and the objectID would be the ID of the opportunity you would like to attach it to. To retrieve the attachments related to an opportunity you can use the GET /{objectName}/{objectId}/attachments API.