Collection download via API call

I’m hoping to use Newman in a Jenkins pipeline to run a Collection.

To that end I want to download the collection from Postman to a local filesystem on my CICD server.

I have read the article at but it looks like the collection files are already in place which isn’t going automatically pickup changes in my Team Collections.

So to reiterate how do I programatically download a collection. Is there an API for this. In fact is there an API for managing Collections in general.

BTW we are using Postman Pro.

1 Like

Hi @TimArmstrong,

  1. You can use the Postman API to download the collection JSON This returns the latest data which is synced.
  2. Save the response in a file <filename>
  3. Finally, you can run the latest collection using newman run <filename>

Hope, this helps.

1 Like

Hello Ankit,

Ok that worked a treat.

Will update my question when I get everything working.


1 Like

@ankit-mI don’t think there is a need to save the response as a file. You should be able to directly call the API using newman run .

1 Like

Hello Abhinav,

So I tried a few things but couldn’t get things to work as a one line command.

Last failed attempt was

newman run


@TimArmstrong You can follow the link to call Postman Pro APIs to fetch the collections and environments (If required for Newman run) at the time of Newman run. (No need to store them in any file)

Few points:-

  1. You are required to have a valid API key to fetch collection/environments
  2. The uid is the user_id-collection_id which you have to provide to fetch the specific collection for Newman run.

Hope this is what you are looking for.

Hello Prakhar,

So it’s working now.

newman run “” -e DEV1_Environment.json

My problem was I had not wrapped my URL in double quotes and so I suspect the shell was helping me by further interpreting my command and make a mess of things.


1 Like