Is is possible to sort an imported API Collection

I would like to sort my collection API based on name, rather than it’s current default.

I am importing from an export in OpenAPI3 from AWS ApiGateway and the list is completely out of order.

I find it hard to get to the API I am looking for when there are many endpoints.


Hi @purringpigeon

I have just written a real ‘hacky’ way of doing it;

Export the collection you want to sort and copy the raw JSON.
Then paste/save this JSON into a variable;

Create a POST request using
And in Body > Raw enter your JSON variable name;


In your pre-req script, put this code;

const jsonResponse = JSON.parse(pm.collectionVariables.get("json"));
let x = jsonResponse.item;

x.sort((a, b) => {
    let fa =,
        fb =;

    if (fa < fb) {
        return -1;
    if (fa > fb) {
        return 1;
    return 0;

let y = JSON.stringify(x);

Then in the ‘Tests’ tab, build the new JSON structure like this;

const jsonResponse = JSON.parse(pm.collectionVariables.get("json"));

let x = "{ \"info\": " + JSON.stringify( + 
" , \"item\": " + JSON.stringify(pm.response.json().data) + 
", \"event\":  "+ JSON.stringify(jsonResponse.event) + 
", \"variable\":  "+ JSON.stringify(jsonResponse.variable) + " }"


This will output to console like so;

Then Import as ‘Raw text’;

it should recognise it as a collection;



Note; This is for a basic collection. If yours has folders/subfolders you may need to alter the code in the ‘Tests’ tab.

Further update;