API for action with file upload

I’m trying to follow this doc to set up my API for my action: https://www.palantir.com/docs/foundry/api/v1/ontology-resources/actions/apply-action

However, my action has a file attachment as an input, and it doesn’t seem that I can use multipart/form-data as the Content-Type.

{
    "errorCode": "INVALID_ARGUMENT",
    "errorName": "InvalidContentType",
    "errorInstanceId": "92ce44bf-718c-4932-bacf-902af620a7dc",
    "parameters": {
        "expectedContentType": "application/json"
    }
}

How do I set up this API?

Attachment properties for actions need to be uploaded separately before applying the action.

Please see this endpoint on how to upload an attachment and recieve an attachment rid

The action will take a string property that corresponds to the attachment RID from the upload request.

Is there any way to automate the action to trigger after using the upload attachments API