Automate publishing to the Private API Network using the Postman API

The Private API Network is available on Postman Enterprise plans.

You can use the Postman API to programmatically manage your Private API Network’s resources. With it, you can easily automate the publication of your team's Private API Network.

Getting started

You can get started by forking the Postman API collection in the Postman Public Workspace. This collection contains all the available Private API Network endpoints.

You will also need an API key to use the Postman API. For information, see Generate a Postman API key.

Access rate limits for your Postman account depend on your Postman plan. For more information, see Postman API rate limits.

Create a Private API Network folder

This HTTP request creates a folder in your Private API Network. A folder can contain multiple elements, such as workspaces, collections, or APIs.

In your request, we recommend using an environment variable (like {{postman-api-key}}) so you can easily reuse your API key. By default, this API creates the folder in the root Home folder of the Private API Network:

POST /network/private HTTP/1.1
Host: api.getpostman.com
Content-Type: application/json
X-API-Key: {{postman-api-key}}
Content-Length: 94

{
    "folder": {
        "name": "Billing",
        "description": "The Billing API."
    }
}

The same HTTP request in Postman:

The API call in Postman

On success, your request’s response will look similar to the following:

{
    "id": 1,
    "parentFolderId": 0,
    "updatedAt": "2023-08-03T13:18:25.000Z",
    "updatedBy": 12345678,
    "createdBy": 12345678,
    "createdAt": "2023-08-03T13:18:25.000Z",
    "name": "Billing",
    "description": "The Billing API.",
    "type": "folder"
}

You can also find your new folder in the Private API Network's root Home directory:

New folder in Private Network

Save the id value in the response. For example, save it as a collection variable called {{folderId}}. You can then use it as the parentFolderId value in other requests, such as adding elements to the folder or subfolders.

Add elements to your Private API Network folder

Your Private API Network folder's elements (collections, APIs, and workspaces) are links to the original element. If that source element changes, then the Private API Network automatically reflects these changes.

In the following examples, the {{folderId}} variable references the id value returned when you created the Private API Network folder (for example, 1).

Add a collection to a folder

This HTTP request adds a collection to your Private API Network folder.

POST /network/private HTTP/1.1
Host: api.getpostman.com
Content-Type: application/json
x-api-key: {{postman-api-key}}
Content-Length: 131

{
    "collection": {
        "id": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
        "parentFolderId": {{folderId}}
    }
}

The response to this request will look similar to the following:

{
    "addedAt": "2023-08-03T13:18:25.000Z",
    "addedBy": 12345678,
    "createdBy": 12345678,
    "createdAt": "2023-08-03T13:18:25.000Z",
    "updatedBy": 12345678,
    "updatedAt": "2023-08-03T13:18:25.000Z",
    "type": "collection",
    "id": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "name": "Billing API Collection",
    "summary": null,
    "description": "The Billing API collection.",
    "href": "https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "parentFolderId": 1
}

Add an API to a folder

Before you add an API to your Private API Network folder, first make sure it's published. Private API Network APIs must have a published version associated with it.

Then, use the following HTTP request to add an API to the Private API Network folder:

POST /network/private HTTP/1.1
Host: api.getpostman-beta.com
Content-Type: application/json
x-api-key: {{postman-api-key}}
Content-Length: 115

{
    "api": {
        "id": "5360b75f-447e-467c-9299-12fd6c92450d",
        "parentFolderId": {{folderId}}
    }
}

The response to this request will be similar to the following:

{
    "addedAt": "2023-08-03T13:18:25.000Z",
    "addedBy": 12345678,
    "createdBy": 12345678,
    "createdAt": "2023-08-03T13:18:25.000Z",
    "updatedBy": 12345678,
    "updatedAt": "2023-08-03T13:18:25.000Z",
    "type": "api",
    "id": "5360b75f-447e-467c-9299-12fd6c92450d",
    "name": "Billing API",
    "summary": "The payments and account services API.",
    "description": null,
    "href": "https://api.getpostman.com/apis/5360b75f-447e-467c-9299-12fd6c92450d",
    "parentFolderId": 1
}

Add a workspace to a folder

This HTTP request adds a workspace to your Private API Network folder:

POST /network/private HTTP/1.1
Host: api.getpostman.com
Content-Type: application/json
x-api-key: {{postman-api-key}}
Content-Length: 121

{
    "workspace": {
        "id": "1f0df51a-8658-4ee8-a2a1-d2567dfa09a9",
        "parentFolderId": {{folderId}}
    }
}

The response to this request will be similar to the following:

{
    "addedAt": "2023-08-03T13:18:25.000Z",
    "addedBy": 12345678,
    "createdBy": 12345678,
    "createdAt": "2023-08-03T13:18:25.000Z",
    "updatedBy": 12345678,
    "updatedAt": "2023-08-03T13:18:25.000Z",
    "type": "workspace",
    "id": "1f0df51a-8658-4ee8-a2a1-d2567dfa09a9",
    "name": "Billing Team Workspace",
    "summary": "The Billing team's workspace.",
    "description": "The Billing team's workspace.",
    "href": "https://api.getpostman.com/workspaces/1f0df51a-8658-4ee8-a2a1-d2567dfa09a9",
    "parentFolderId": 1
}

Last modified: 2023/08/02