For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Postman
PricingEnterprise
Contact SalesSign InSign Up for Free
HomeDocs
HomeDocs
      • Overview
        • Run and test collections with Newman CLI
        • Install and run Newman
        • Newman command reference
        • Upload files with Newman
        • Use Newman built-in reporters
        • Use Newman external and custom reporters
        • Newman with Docker
        • CI with Newman
        • Travis CI with Newman
        • Jenkins with Newman
        • Migrate to the Postman CLI
Postman API Platform

Product

  • Postman Overview
  • Enterprise
  • Spec Hub
  • Flows
  • Agent Mode
  • API Catalog
  • Fern
  • Postman CLI
  • Integrations
  • Workspaces
  • Plans and pricing

API Network

  • App Security
  • Artificial Intelligence
  • Communication
  • Data Analytics
  • Database
  • Developer Productivity
  • DevOps
  • Ecommerce
  • eSignature
  • Financial Services
  • Payments
  • Travel

Resources

  • Postman Docs
  • Academy
  • Community
  • Templates
  • Intergalactic
  • Videos
  • MCP Servers

Legal and Security

  • Legal Terms Hub
  • Terms of Service
  • Postman Product Terms
  • Security
  • Website Terms of Use

Company

  • About
  • Careers and culture
  • Contact us
  • Partner program
  • Customer stories
  • Student programs
  • Press and media
Twitter iconLinkedIn iconGithub iconYouTube iconInstagram iconDiscord icon
Download Postman
Privacy Policy

© 2026 Postman, Inc.

ReferenceNewman CLI

Upload test data files with Newman

||View as Markdown|
Was this page helpful?
Previous

Newman command reference

Next

Generate collection run reports with Newman built-in reporters

Built with

Newman supports file uploads so you can send test data (form data or a binary) with an API request. The data file must be located in the same working directory as the collection JSON file you are running. Also, you must include the filename in the src attribute of the request.

The following example shows the exported JSON file for a collection named file-upload. The collection has a single request that uploads a form data file named sample-file.txt in the request body.

1// the filename is sample-file.txt
2{
3 "info": {
4 "_postman_id": "9dbfcf22-fdf4-f328-e440-95dbd8e4cfbb",
5 "name": "file-upload",
6 "description": "A set of `POST` requests to upload files as form data fields",
7 "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
8 },
9 "item": [
10 {
11 "name": "Form data upload",
12 "event": [
13 {
14 "listen": "test",
15 "script": {
16 "exec": [
17 "const uploadedFile = pm.response.json()?.files['sample-file.txt'];",
18 "",
19 "pm.test(\"Status code is 200\", () => pm.response.to.have.status(200));",
20 "pm.test('File was uploaded correctly', () => pm.expect(uploadedFile).to.match(/^data:application\\/octet-stream;base64/));"
21 ],
22 "type": "text/javascript",
23 "packages": {}
24 }
25 }
26 ],
27 "request": {
28 "method": "POST",
29 "header": [],
30 "body": {
31 "mode": "formdata",
32 "formdata": [
33 {
34 "key": "file",
35 "type": "file",
36 "src": "sample-file.txt"
37 }
38 ]
39 },
40 "url": {
41 "raw": "https://postman-echo.com/post",
42 "protocol": "https",
43 "host": [
44 "postman-echo",
45 "com"
46 ],
47 "path": [
48 "post"
49 ]
50 },
51 "description": "Uploads a file as a form data field to `https://postman-echo.com/post` using a `POST` request."
52 },
53 "response": []
54 }
55 ]
56}

The file sample-file.txt must be present in the same working directory as the collection. Run this collection as usual:

$newman run file-upload.postman_collection.json

You’ll get a message that the file was uploaded correctly, and the test will pass.