--- title: Attachment API description: tags: developer portal --- {%hackmd bXqUSiOGTLuFjPgSJ74wxQ %} # Attachments API [toc] ## Upload an image to a note coming soon <!-- ## Upload a image to a note - `POST https://hackmd.io/uploadimage?noteId=:noteId` - Query params - noteId: string, required - Form Data - image: File - Success Response - code: `200` - body: ```json {"data":{"link":"https://hackmd.io/_uploads/By9HvYLR6.png"}} ``` --> ## Download an attachment - `GET https://hackmd.io/_uploads/:filename` - Url params: - filename: string - Authorization: - [Use the authorization header](https://hackmd.io/@hackmd-api/developer-portal/https%3A%2F%2Fhackmd.io%2F%40hackmd-api%2Fapi-authorization) - Success Response - Trigger the download - Sample usage ```bash # -L option turn on the follow redirection curl -H "Authorization: Bearer TOKEN" https://hackmd.io/_uploads/By9HvYLR6.png -L > output.png ``` :::info :bulb: Note - Turn on the "follow redirection" option in your REST client. - You have to **use the `hackmd.io` domain** instead of the `api.hackmd.io` domain in regular APIs. :::