Rest API attach file in card request - How to attach file to a "create card" request

I would like to make a post request to the rest api with a file reference so that when the card is created using the api there is a file attached. Is that possible? fFom what I saw in the documentation there is a urlSource and fileSource but I am not sure that is what I want.
Thank you

Hello @DiogoOliveira

The fileSource and mimeType parameters are used together if you want to attach a file and you’re prepared to stream the binary blob of data for that file and then define its mime type.

The urlSource parameter is used by itself if you are referencing a file stored somewhere else, say in DropBox or similar, and you know the URL to it. If you use this method, Trello will do all the hard work for you of streaming the binary data from the file at that URL and turning it into an attachment on the new card.

Note. For some silly reason, if file you are attaching using the urlSource parameter method is an image, the image is also placed in the card’s cover, so if you want to undo that, you need to update the card afterwards and ‘reset’ the cover.