I'm creating a confluence page using the REST API and also creating attachments using the API and referencing them from the confluence page and they do appear on the confluence page but they don't have the correct icon (they are JSON files)

and when you attempt to download them you see the following page:

If I edit the page and add a file manually then it renders properly and when I've downloaded the content the difference seems to be that the manually added files have a macro-id property assigned to them. How do I use the REST API to create a macro-id to include in the page content?