How to upload a file with Postman: we'll use Postman to send files (images, binaries, etc.) as multipart/form-data in this simple guide.
Note: We're using Upload.io's File Upload API to upload test files in these examples, but the same steps apply to any API that accepts file uploads. (We're using the API key "free" below, which you can use without needing to create an Upload.io account.)
1) Create a new request
First, let's create a request in Postman:
2) Set the method to POST or PUT
Set the request method to
PUT in the dropdown, depending on your API:
3) Set the URL for your endpoint
Remember to include the
https://api.upload.io/v1/files/form_data in this example:
4) Set the authorization headers (optional)
If your API requires authorization, you must complete this step. (Otherwise skip to the next step.)
The Upload.io API requires a bearer token with the value "free", so we set it below:
5) Upload the file as multipart/form-data
Now to test a file upload in Postman:
First, we'll cover how to upload files using
multipart/form-data as the request body.
(Note: in the next section will cover uploading binary request bodies – i.e. without form encoding.)
5.1 – Set the body to "form-data":
5.2 – Hover your mouse over the first row in the table:
5.3 – Select "File" from the dropdown:
5.4 – Select a file & enter the field name your API uses for the file field:
5.5 – Finally, click "Send":
5.6 – See the result:
Huzzah, it worked!
Sending a binary request body?
In the previous example we used
multipart/form-data for our request body.
But what about using Postman to perform a binary file upload instead?
First, set the body to "binary":
Now click "Select File" in Postman to attach a file:
Finally, click "Send":
You'll notice in our examples we changed the URL from
/basic – this is a detail specific to Upload.io's API, as we support both binary and multipart/form-data uploads, but we use a different URL for each.
The API you're testing will likely support just one of these two options.
Here's the key things to remember when uploading files in Postman:
- Make sure you get your body type correct (form-data and binary are most common).
- Select "File" from the dropdown in the "Key" column – this only appears on hover!
- Remember to add the appropriate auth headers.