> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Add a workspace

POST https://api.getpostman.com/network/private
Content-Type: application/json

Publishes a workspace in your team's [Private API Network](https://learning.postman.com/docs/collaborating-in-postman/adding-private-network/).

Reference: https://learning.postman.com/api-docs/api-reference/private-api-network/add-workspace-to-private-network

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /network/private:
    post:
      operationId: addWorkspaceToPrivateNetwork
      summary: Add a workspace
      description: >-
        Publishes a workspace in your team's [Private API
        Network](https://learning.postman.com/docs/collaborating-in-postman/adding-private-network/).
      tags:
        - privateApiNetwork
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/panElementCreated'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/AddWorkspaceToPrivateNetworkRequestUnauthorizedError
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/AddWorkspaceToPrivateNetworkRequestForbiddenError
        '404':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/panError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/AddWorkspaceToPrivateNetworkRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/panCreateWorkspace'
servers:
  - url: https://api.getpostman.com
    description: https://api.getpostman.com
  - url: https://api.eu.postman.com
    description: https://api.eu.postman.com
components:
  schemas:
    PanCreateWorkspaceWorkspace:
      type: object
      properties:
        id:
          type: string
          description: The workspace's ID.
        parentFolderId:
          type: integer
          default: 0
          description: The `0` value.
      required:
        - id
      title: PanCreateWorkspaceWorkspace
    panCreateWorkspace:
      type: object
      properties:
        workspace:
          $ref: '#/components/schemas/PanCreateWorkspaceWorkspace'
      required:
        - workspace
      title: panCreateWorkspace
    PanElementCreatedType:
      type: string
      enum:
        - workspace
      description: The `workspace` element.
      title: PanElementCreatedType
    panElementCreated:
      type: object
      properties:
        addedAt:
          type: string
          format: date-time
          description: The date and time at which the element was added.
        addedBy:
          type: integer
          description: The user who added the element.
        createdBy:
          type: integer
          description: The user who created the element.
        createdAt:
          type: string
          format: date-time
          description: The date and time at which the element was created.
        updatedBy:
          type: integer
          description: The user who last updated the element.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the element was last updated.
        type:
          $ref: '#/components/schemas/PanElementCreatedType'
          description: The `workspace` element.
        id:
          type: string
          description: The element's ID
        name:
          type: string
          description: The element's name.
        summary:
          type:
            - string
            - 'null'
          description: The element's summary.
        description:
          type:
            - string
            - 'null'
          description: The element's description.
        href:
          type: string
          format: url
          description: The element's Postman URL.
        parentFolderId:
          type:
            - integer
            - 'null'
          description: This property is deprecated.
      description: Information about the Private API Network element.
      title: panElementCreated
    CommonErrorTypeTitleDetailStatusType:
      oneOf:
        - type: string
          format: uri-reference
        - type: string
      title: CommonErrorTypeTitleDetailStatusType
    commonErrorTypeTitleDetailStatus:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailStatusType'
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: Information about the error.
        status:
          type: integer
          description: The error's HTTP status code.
      title: commonErrorTypeTitleDetailStatus
    CommonErrorNameMessageError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: CommonErrorNameMessageError
    commonErrorNameMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageError'
          description: Information about the error.
      title: commonErrorNameMessage
    AddWorkspaceToPrivateNetworkRequestUnauthorizedError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: AddWorkspaceToPrivateNetworkRequestUnauthorizedError
    AddWorkspaceToPrivateNetworkRequestForbiddenError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: AddWorkspaceToPrivateNetworkRequestForbiddenError
    panError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      title: panError
    CommonErrorTypeTitleDetailDetail:
      oneOf:
        - type: string
        - type: object
          additionalProperties:
            description: Any type
      description: Information about the error.
      title: CommonErrorTypeTitleDetailDetail
    commonErrorTypeTitleDetail:
      type: object
      properties:
        type:
          type: string
          description: The type of error.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailDetail'
          description: Information about the error.
      title: commonErrorTypeTitleDetail
    AddWorkspaceToPrivateNetworkRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: AddWorkspaceToPrivateNetworkRequestInternalServerError
  securitySchemes:
    PostmanApiKey:
      type: apiKey
      in: header
      name: x-api-key
    scimApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        A valid [SCIM API
        key](https://learning.postman.com/docs/administration/scim-provisioning/scim-provisioning-overview/#generating-scim-api-key)
        for calls to SCIM endpoints.
    basicAuth:
      type: http
      scheme: basic

```

## Examples



**Request**

```json
{
  "workspace": {
    "id": "1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"
  }
}
```

**Response**

```json
{
  "addedAt": "2024-12-07T17:59:23.000Z",
  "addedBy": 12345678,
  "createdBy": 12345678,
  "createdAt": "2024-12-07T17:59:23.000Z",
  "updatedBy": 12345678,
  "updatedAt": "2024-12-07T17:59:23.000Z",
  "type": "workspace",
  "id": "1f0df51a-8658-4ee8-a2a1-d2567dfa09a9",
  "name": "Billing Team Workspace",
  "summary": "The Billing team's workspace.",
  "description": null,
  "href": "https://api.getpostman.com/workspaces/1f0df51a-8658-4ee8-a2a1-d2567dfa09a9",
  "parentFolderId": null
}
```

**SDK Code**

```python Add a Workspace
import requests

url = "https://api.getpostman.com/network/private"

payload = { "workspace": { "id": "1f0df51a-8658-4ee8-a2a1-d2567dfa09a9" } }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add a Workspace
const url = 'https://api.getpostman.com/network/private';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"workspace":{"id":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add a Workspace
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/network/private"

	payload := strings.NewReader("{\n  \"workspace\": {\n    \"id\": \"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add a Workspace
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/network/private")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"workspace\": {\n    \"id\": \"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Add a Workspace
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/network/private")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"workspace\": {\n    \"id\": \"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9\"\n  }\n}")
  .asString();
```

```php Add a Workspace
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/network/private', [
  'body' => '{
  "workspace": {
    "id": "1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Add a Workspace
using RestSharp;

var client = new RestClient("https://api.getpostman.com/network/private");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"workspace\": {\n    \"id\": \"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a Workspace
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["workspace": ["id": "1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/network/private")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```