Attaching PDF attachments fail in the API POST call

Two things I’d recommend checking out.

First, this Glitch.com project that has a lot of examples on how to attach stuff via the API: Trello Attachments Api.

Second, I’d recommend following whatever the Trello web client does. To do so, open your browser’s console and watch the network as you attach a .pdf to a card.