Here is how we upload an image using a rest api endpoint. For this example I will be using gitlab uploads API

This how we post a PNG to an api using postman.

Add header Content-Type: multipart/form-data and then add the png image as following

postman multi part file

Below is what happens on the wire to send. The content-type multipart/form-data basically allows us to send a form with multiple attributes of the form seperated with a boundry ----WebKitFormBoundary7MA4YWxkTrZu0gW.

POST /projects//uploads HTTP/1.1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Authorization: Bearer 

Content-Disposition: form-data; name="file"; filename="capture.png"
Content-Type: image/png

(image data)