> 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 collection

POST https://api.getpostman.com/apis/{apiId}/collections
Content-Type: application/json

Adds a collection to an API. To do this, use the following `operationType` values:

- `COPY_COLLECTION` — Copies a collection from the workspace and adds it to an API.
- `CREATE_NEW` — Creates a new collection by providing the new collection's content.
- `GENERATE_FROM_SCHEMA` — Generates the collection from an API schema.
    - `options` — An object that contains advanced creation options and their values. You can find a complete list of properties and their values in Postman's [OpenAPI to Postman Collection Converter OPTIONS documentation](https://github.com/postmanlabs/openapi-to-postman/blob/develop/OPTIONS.md). These properties are case-sensitive.


Reference: https://learning.postman.com/api-docs/api-reference/api/add-api-collection

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /apis/{apiId}/collections:
    post:
      operationId: addApiCollection
      summary: Add a collection
      description: >
        Adds a collection to an API. To do this, use the following
        `operationType` values:


        - `COPY_COLLECTION` — Copies a collection from the workspace and adds it
        to an API.

        - `CREATE_NEW` — Creates a new collection by providing the new
        collection's content.

        - `GENERATE_FROM_SCHEMA` — Generates the collection from an API schema.
            - `options` — An object that contains advanced creation options and their values. You can find a complete list of properties and their values in Postman's [OpenAPI to Postman Collection Converter OPTIONS documentation](https://github.com/postmanlabs/openapi-to-postman/blob/develop/OPTIONS.md). These properties are case-sensitive.
      tags:
        - api
      parameters:
        - name: apiId
          in: path
          description: The API's ID.
          required: true
          schema:
            $ref: '#/components/schemas/apiId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
        - name: Accept
          in: header
          description: >-
            The `application/vnd.api.v10+json` request header required to use
            the endpoint.
          required: true
          schema:
            $ref: '#/components/schemas/v10Accept'
      responses:
        '200':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/addApiCollectionResponse'
        '400':
          description: Missing v10 Accept Header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiErrorNameMessage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddApiCollectionRequestForbiddenError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddApiCollectionRequestNotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/AddApiCollectionRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/API_addApiCollection_Request'
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:
    apiId:
      type: string
      title: apiId
    v10Accept:
      type: string
      enum:
        - application/vnd.api.v10+json
      title: v10Accept
    CopyCollectionToApiData:
      type: object
      properties:
        collectionId:
          type: string
          description: The collection ID to copy to the API.
      title: CopyCollectionToApiData
    CopyCollectionToApiOperationType:
      type: string
      enum:
        - COPY_COLLECTION
      description: The `COPY_COLLECTION` method.
      title: CopyCollectionToApiOperationType
    copyCollectionToApi:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CopyCollectionToApiData'
        operationType:
          $ref: '#/components/schemas/CopyCollectionToApiOperationType'
          description: The `COPY_COLLECTION` method.
      title: copyCollectionToApi
    CreateApiCollectionDataInfoSchema:
      type: string
      enum:
        - https://schema.getpostman.com/json/collection/v2.1.0/collection.json
      description: The collection's schema format.
      title: CreateApiCollectionDataInfoSchema
    CreateApiCollectionDataInfo:
      type: object
      properties:
        name:
          type: string
          description: The collection's name.
        schema:
          $ref: '#/components/schemas/CreateApiCollectionDataInfoSchema'
          description: The collection's schema format.
      description: Information about the collection.
      title: CreateApiCollectionDataInfo
    CreateApiCollectionData:
      type: object
      properties:
        info:
          $ref: '#/components/schemas/CreateApiCollectionDataInfo'
          description: Information about the collection.
        item:
          type: array
          items:
            description: Any type
          description: >-
            Information about the requests and responses in the collection. For
            a complete list of values, refer to the [Postman Collection Format
            documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).
      description: >-
        Information about the collection's contents, such as requests and
        responses. For a complete list of values, refer to the [Postman
        Collection Format
        documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).
      title: CreateApiCollectionData
    CreateApiCollectionOperationType:
      type: string
      enum:
        - CREATE_NEW
      description: The `CREATE_NEW` method.
      title: CreateApiCollectionOperationType
    createApiCollection:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CreateApiCollectionData'
          description: >-
            Information about the collection's contents, such as requests and
            responses. For a complete list of values, refer to the [Postman
            Collection Format
            documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).
        operationType:
          $ref: '#/components/schemas/CreateApiCollectionOperationType'
          description: The `CREATE_NEW` method.
      title: createApiCollection
    GenerateApiFromSchemaOperationType:
      type: string
      enum:
        - GENERATE_FROM_SCHEMA
      description: The `GENERATE_FROM_SCHEMA` method.
      title: GenerateApiFromSchemaOperationType
    generateApiFromSchema:
      type: object
      properties:
        name:
          type: string
          description: The collection's name.
        operationType:
          $ref: '#/components/schemas/GenerateApiFromSchemaOperationType'
          description: The `GENERATE_FROM_SCHEMA` method.
        options:
          type: object
          additionalProperties:
            description: Any type
          description: >-
            The advanced creation options for collections and their values. For
            a complete list of properties and their values, see Postman's
            [OpenAPI to Postman Collection Converter OPTIONS
            documentation](https://github.com/postmanlabs/openapi-to-postman/blob/develop/OPTIONS.md).
            These properties are case-sensitive.
      title: generateApiFromSchema
    API_addApiCollection_Request:
      oneOf:
        - $ref: '#/components/schemas/copyCollectionToApi'
        - $ref: '#/components/schemas/createApiCollection'
        - $ref: '#/components/schemas/generateApiFromSchema'
      title: API_addApiCollection_Request
    addApiCollectionResponse:
      type: object
      properties:
        id:
          type: string
          description: The collection's ID.
      title: addApiCollectionResponse
    apiErrorNameMessage:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      title: apiErrorNameMessage
    commonErrorTypeTitleDetailStatusInstance:
      type: object
      properties:
        type:
          type: string
          format: uri-reference
          description: >-
            The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that
            identifies the type of problem.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: An explanation about the problem.
        status:
          type: integer
          description: The HTTP status code generated by the origin server.
        instance:
          type: string
          description: >-
            The URI reference that identifies the specific occurrence of the
            problem.
      title: commonErrorTypeTitleDetailStatusInstance
    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
    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
    commonErrorTypeTitleMessageDetail:
      type: object
      properties:
        type:
          type: string
          description: The type of error.
        title:
          type: string
          description: A short summary of the problem.
        message:
          type: string
          description: The error message.
        detail:
          type: object
          additionalProperties:
            description: Any type
          description: Information about the error.
      title: commonErrorTypeTitleMessageDetail
    AddApiCollectionRequestForbiddenError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorTypeTitleMessageDetail'
      title: AddApiCollectionRequestForbiddenError
    CommonErrorErrorObjTypeTitleDetailError:
      type: object
      properties:
        type:
          type: string
          description: The type of error.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: Details about the error.
      description: Information about the error.
      title: CommonErrorErrorObjTypeTitleDetailError
    commonErrorErrorObjTypeTitleDetail:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorErrorObjTypeTitleDetailError'
          description: Information about the error.
      title: commonErrorErrorObjTypeTitleDetail
    AddApiCollectionRequestNotFoundError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorErrorObjTypeTitleDetail'
      title: AddApiCollectionRequestNotFoundError
    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
    AddApiCollectionRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: AddApiCollectionRequestInternalServerError
  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

### API Collection Created



**Request**

```json
undefined
```

**Response**

```json
{
  "id": "12345678-61867bcc-c4c1-11ed-afa1-0242ac120002"
}
```

**SDK Code**

```python API Collection Created
import requests

url = "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

headers = {
    "Accept": "application/vnd.api.v10+json",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript API Collection Created
const url = 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections';
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/vnd.api.v10+json',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: undefined
};

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

```go API Collection Created
package main

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

func main() {

	url := "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

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

	req.Header.Add("Accept", "application/vnd.api.v10+json")
	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 API Collection Created
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")

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

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/vnd.api.v10+json'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

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

```java API Collection Created
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")
  .header("Accept", "application/vnd.api.v10+json")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php API Collection Created
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections', [
  'headers' => [
    'Accept' => 'application/vnd.api.v10+json',
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp API Collection Created
using RestSharp;

var client = new RestClient("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/vnd.api.v10+json");
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift API Collection Created
import Foundation

let headers = [
  "Accept": "application/vnd.api.v10+json",
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Copy a Collection



**Request**

```json
{
  "data": {
    "collectionId": "12ece9e1-2abf-4edc-8e34-de66e74114d2"
  },
  "operationType": "COPY_COLLECTION"
}
```

**Response**

```json
{
  "id": "12345678-61867bcc-c4c1-11ed-afa1-0242ac120002"
}
```

**SDK Code**

```python Copy a Collection
import requests

url = "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

payload = {
    "data": { "collectionId": "12ece9e1-2abf-4edc-8e34-de66e74114d2" },
    "operationType": "COPY_COLLECTION"
}
headers = {
    "Accept": "application/vnd.api.v10+json",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Copy a Collection
const url = 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections';
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/vnd.api.v10+json',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"data":{"collectionId":"12ece9e1-2abf-4edc-8e34-de66e74114d2"},"operationType":"COPY_COLLECTION"}'
};

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

```go Copy a Collection
package main

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

func main() {

	url := "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

	payload := strings.NewReader("{\n  \"data\": {\n    \"collectionId\": \"12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n  },\n  \"operationType\": \"COPY_COLLECTION\"\n}")

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

	req.Header.Add("Accept", "application/vnd.api.v10+json")
	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 Copy a Collection
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")

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

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/vnd.api.v10+json'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"data\": {\n    \"collectionId\": \"12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n  },\n  \"operationType\": \"COPY_COLLECTION\"\n}"

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

```java Copy a Collection
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")
  .header("Accept", "application/vnd.api.v10+json")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"data\": {\n    \"collectionId\": \"12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n  },\n  \"operationType\": \"COPY_COLLECTION\"\n}")
  .asString();
```

```php Copy a Collection
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections', [
  'body' => '{
  "data": {
    "collectionId": "12ece9e1-2abf-4edc-8e34-de66e74114d2"
  },
  "operationType": "COPY_COLLECTION"
}',
  'headers' => [
    'Accept' => 'application/vnd.api.v10+json',
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Copy a Collection
using RestSharp;

var client = new RestClient("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/vnd.api.v10+json");
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"data\": {\n    \"collectionId\": \"12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n  },\n  \"operationType\": \"COPY_COLLECTION\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Copy a Collection
import Foundation

let headers = [
  "Accept": "application/vnd.api.v10+json",
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "data": ["collectionId": "12ece9e1-2abf-4edc-8e34-de66e74114d2"],
  "operationType": "COPY_COLLECTION"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")! 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()
```

### Generate a Collection from Schema



**Request**

```json
{
  "name": "Test Collection",
  "operationType": "GENERATE_FROM_SCHEMA",
  "options": {
    "enableOptionalParameters": true,
    "folderStrategy": "Tags"
  }
}
```

**Response**

```json
{
  "id": "12345678-61867bcc-c4c1-11ed-afa1-0242ac120002"
}
```

**SDK Code**

```python Generate a Collection from Schema
import requests

url = "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

payload = {
    "name": "Test Collection",
    "operationType": "GENERATE_FROM_SCHEMA",
    "options": {
        "enableOptionalParameters": True,
        "folderStrategy": "Tags"
    }
}
headers = {
    "Accept": "application/vnd.api.v10+json",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Generate a Collection from Schema
const url = 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections';
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/vnd.api.v10+json',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"Test Collection","operationType":"GENERATE_FROM_SCHEMA","options":{"enableOptionalParameters":true,"folderStrategy":"Tags"}}'
};

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

```go Generate a Collection from Schema
package main

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

func main() {

	url := "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

	payload := strings.NewReader("{\n  \"name\": \"Test Collection\",\n  \"operationType\": \"GENERATE_FROM_SCHEMA\",\n  \"options\": {\n    \"enableOptionalParameters\": true,\n    \"folderStrategy\": \"Tags\"\n  }\n}")

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

	req.Header.Add("Accept", "application/vnd.api.v10+json")
	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 Generate a Collection from Schema
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")

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

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/vnd.api.v10+json'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Test Collection\",\n  \"operationType\": \"GENERATE_FROM_SCHEMA\",\n  \"options\": {\n    \"enableOptionalParameters\": true,\n    \"folderStrategy\": \"Tags\"\n  }\n}"

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

```java Generate a Collection from Schema
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")
  .header("Accept", "application/vnd.api.v10+json")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Test Collection\",\n  \"operationType\": \"GENERATE_FROM_SCHEMA\",\n  \"options\": {\n    \"enableOptionalParameters\": true,\n    \"folderStrategy\": \"Tags\"\n  }\n}")
  .asString();
```

```php Generate a Collection from Schema
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections', [
  'body' => '{
  "name": "Test Collection",
  "operationType": "GENERATE_FROM_SCHEMA",
  "options": {
    "enableOptionalParameters": true,
    "folderStrategy": "Tags"
  }
}',
  'headers' => [
    'Accept' => 'application/vnd.api.v10+json',
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Generate a Collection from Schema
using RestSharp;

var client = new RestClient("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/vnd.api.v10+json");
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Test Collection\",\n  \"operationType\": \"GENERATE_FROM_SCHEMA\",\n  \"options\": {\n    \"enableOptionalParameters\": true,\n    \"folderStrategy\": \"Tags\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Generate a Collection from Schema
import Foundation

let headers = [
  "Accept": "application/vnd.api.v10+json",
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Test Collection",
  "operationType": "GENERATE_FROM_SCHEMA",
  "options": [
    "enableOptionalParameters": true,
    "folderStrategy": "Tags"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")! 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()
```

### Add a New Collection



**Request**

```json
{
  "data": {
    "auth": {
      "apikey": [
        {
          "key": "key",
          "value": "X-Api-Key"
        },
        {
          "key": "value",
          "value": "{{apiKey}}"
        },
        {
          "key": "in",
          "value": "header"
        }
      ],
      "type": "apikey"
    },
    "info": {
      "_postman_id": "e726de58-f1b3-4edd-a8a7-2579dc799d39",
      "description": "Buy or rent spacecrafts",
      "name": "Generated",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
      {
        "id": "d3779255-5293-4e58-9b65-8954936e1dca",
        "name": "Read a spacecraft",
        "protocolProfileBehavior": {
          "disableBodyPruning": true
        },
        "request": {
          "header": [
            {
              "key": "Accept",
              "value": "application/json"
            }
          ],
          "method": "GET",
          "url": {
            "host": [
              "https://api.getpostman.com"
            ],
            "path": [
              "spacecrafts",
              ":spacecraftId"
            ],
            "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
            "variable": [
              {
                "description": "(Required) The unique identifier of the spacecraft",
                "key": "spacecraftId",
                "value": "<string>"
              }
            ]
          }
        },
        "response": [
          {
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{\n  \"id\": \"<string>\",\n  \"name\": \"commodo\",\n  \"type\": \"capsule\",\n  \"description\": \"pariatur dolo\"\n}",
            "code": 200,
            "cookie": [],
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "id": "54467f6e-71d7-43d5-acc0-48f948e38528",
            "name": "The spacecraft corresponding to the provided `spacecraftId`",
            "originalRequest": {
              "header": [
                {
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                }
              ],
              "method": "GET",
              "url": {
                "host": [
                  "https://api.getpostman.com"
                ],
                "path": [
                  "spacecrafts",
                  ":spacecraftId"
                ],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  {
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  }
                ]
              }
            },
            "responseTime": null,
            "status": "OK"
          },
          {
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{\n  \"message\": \"dolore Excepteur\"\n}",
            "code": 404,
            "cookie": [],
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "id": "1231609a-7a3d-444d-aa0c-579703e618f4",
            "name": "No spacecraft found for the provided `spacecraftId`",
            "originalRequest": {
              "header": [
                {
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                }
              ],
              "method": "GET",
              "url": {
                "host": [
                  "https://api.getpostman.com"
                ],
                "path": [
                  "spacecrafts",
                  ":spacecraftId"
                ],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  {
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  }
                ]
              }
            },
            "responseTime": null,
            "status": "Not Found"
          },
          {
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{\n  \"message\": \"dolore Excepteur\"\n}",
            "code": 500,
            "cookie": [],
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "id": "db674465-8cec-4208-9724-42278ca9b83c",
            "name": "Unexpected error",
            "originalRequest": {
              "header": [
                {
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                }
              ],
              "method": "GET",
              "url": {
                "host": [
                  "https://api.getpostman.com"
                ],
                "path": [
                  "spacecrafts",
                  ":spacecraftId"
                ],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  {
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  }
                ]
              }
            },
            "responseTime": null,
            "status": "Internal Server Error"
          }
        ]
      }
    ],
    "variable": [
      {
        "id": "526a20ba-acfb-4549-a841-8edf2d24b929",
        "key": "baseUrl",
        "type": "string",
        "value": "/"
      }
    ]
  },
  "operationType": "CREATE_NEW"
}
```

**Response**

```json
{
  "id": "12345678-61867bcc-c4c1-11ed-afa1-0242ac120002"
}
```

**SDK Code**

```python Add a New Collection
import requests

url = "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

payload = {
    "data": {
        "auth": {
            "apikey": [
                {
                    "key": "key",
                    "value": "X-Api-Key"
                },
                {
                    "key": "value",
                    "value": "{{apiKey}}"
                },
                {
                    "key": "in",
                    "value": "header"
                }
            ],
            "type": "apikey"
        },
        "info": {
            "_postman_id": "e726de58-f1b3-4edd-a8a7-2579dc799d39",
            "description": "Buy or rent spacecrafts",
            "name": "Generated",
            "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
        },
        "item": [
            {
                "id": "d3779255-5293-4e58-9b65-8954936e1dca",
                "name": "Read a spacecraft",
                "protocolProfileBehavior": { "disableBodyPruning": True },
                "request": {
                    "header": [
                        {
                            "key": "Accept",
                            "value": "application/json"
                        }
                    ],
                    "method": "GET",
                    "url": {
                        "host": ["https://api.getpostman.com"],
                        "path": ["spacecrafts", ":spacecraftId"],
                        "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                        "variable": [
                            {
                                "description": "(Required) The unique identifier of the spacecraft",
                                "key": "spacecraftId",
                                "value": "<string>"
                            }
                        ]
                    }
                },
                "response": [
                    {
                        "_postman_previewlanguage": "json",
                        "_postman_previewtype": "html",
                        "body": "{
  \"id\": \"<string>\",
  \"name\": \"commodo\",
  \"type\": \"capsule\",
  \"description\": \"pariatur dolo\"
}",
                        "code": 200,
                        "cookie": [],
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "id": "54467f6e-71d7-43d5-acc0-48f948e38528",
                        "name": "The spacecraft corresponding to the provided `spacecraftId`",
                        "originalRequest": {
                            "header": [
                                {
                                    "description": "Added as a part of security scheme: apikey",
                                    "key": "X-Api-Key",
                                    "value": "<API Key>"
                                }
                            ],
                            "method": "GET",
                            "url": {
                                "host": ["https://api.getpostman.com"],
                                "path": ["spacecrafts", ":spacecraftId"],
                                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                                "variable": [
                                    {
                                        "description": "(Required) The unique identifier of the spacecraft",
                                        "key": "spacecraftId",
                                        "value": "<string>"
                                    }
                                ]
                            }
                        },
                        "responseTime": None,
                        "status": "OK"
                    },
                    {
                        "_postman_previewlanguage": "json",
                        "_postman_previewtype": "html",
                        "body": "{
  \"message\": \"dolore Excepteur\"
}",
                        "code": 404,
                        "cookie": [],
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "id": "1231609a-7a3d-444d-aa0c-579703e618f4",
                        "name": "No spacecraft found for the provided `spacecraftId`",
                        "originalRequest": {
                            "header": [
                                {
                                    "description": "Added as a part of security scheme: apikey",
                                    "key": "X-Api-Key",
                                    "value": "<API Key>"
                                }
                            ],
                            "method": "GET",
                            "url": {
                                "host": ["https://api.getpostman.com"],
                                "path": ["spacecrafts", ":spacecraftId"],
                                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                                "variable": [
                                    {
                                        "description": "(Required) The unique identifier of the spacecraft",
                                        "key": "spacecraftId",
                                        "value": "<string>"
                                    }
                                ]
                            }
                        },
                        "responseTime": None,
                        "status": "Not Found"
                    },
                    {
                        "_postman_previewlanguage": "json",
                        "_postman_previewtype": "html",
                        "body": "{
  \"message\": \"dolore Excepteur\"
}",
                        "code": 500,
                        "cookie": [],
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "id": "db674465-8cec-4208-9724-42278ca9b83c",
                        "name": "Unexpected error",
                        "originalRequest": {
                            "header": [
                                {
                                    "description": "Added as a part of security scheme: apikey",
                                    "key": "X-Api-Key",
                                    "value": "<API Key>"
                                }
                            ],
                            "method": "GET",
                            "url": {
                                "host": ["https://api.getpostman.com"],
                                "path": ["spacecrafts", ":spacecraftId"],
                                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                                "variable": [
                                    {
                                        "description": "(Required) The unique identifier of the spacecraft",
                                        "key": "spacecraftId",
                                        "value": "<string>"
                                    }
                                ]
                            }
                        },
                        "responseTime": None,
                        "status": "Internal Server Error"
                    }
                ]
            }
        ],
        "variable": [
            {
                "id": "526a20ba-acfb-4549-a841-8edf2d24b929",
                "key": "baseUrl",
                "type": "string",
                "value": "/"
            }
        ]
    },
    "operationType": "CREATE_NEW"
}
headers = {
    "Accept": "application/vnd.api.v10+json",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Add a New Collection
const url = 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections';
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/vnd.api.v10+json',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"data":{"auth":{"apikey":[{"key":"key","value":"X-Api-Key"},{"key":"value","value":"{{apiKey}}"},{"key":"in","value":"header"}],"type":"apikey"},"info":{"_postman_id":"e726de58-f1b3-4edd-a8a7-2579dc799d39","description":"Buy or rent spacecrafts","name":"Generated","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"id":"d3779255-5293-4e58-9b65-8954936e1dca","name":"Read a spacecraft","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"header":[{"key":"Accept","value":"application/json"}],"method":"GET","url":{"host":["https://api.getpostman.com"],"path":["spacecrafts",":spacecraftId"],"raw":"https://api.getpostman.com/spacecrafts/:spacecraftId","variable":[{"description":"(Required) The unique identifier of the spacecraft","key":"spacecraftId","value":"<string>"}]}},"response":[{"_postman_previewlanguage":"json","_postman_previewtype":"html","body":"{\n  \"id\": \"<string>\",\n  \"name\": \"commodo\",\n  \"type\": \"capsule\",\n  \"description\": \"pariatur dolo\"\n}","code":200,"cookie":[],"header":[{"key":"Content-Type","value":"application/json"}],"id":"54467f6e-71d7-43d5-acc0-48f948e38528","name":"The spacecraft corresponding to the provided `spacecraftId`","originalRequest":{"header":[{"description":"Added as a part of security scheme: apikey","key":"X-Api-Key","value":"<API Key>"}],"method":"GET","url":{"host":["https://api.getpostman.com"],"path":["spacecrafts",":spacecraftId"],"raw":"https://api.getpostman.com/spacecrafts/:spacecraftId","variable":[{"description":"(Required) The unique identifier of the spacecraft","key":"spacecraftId","value":"<string>"}]}},"responseTime":null,"status":"OK"},{"_postman_previewlanguage":"json","_postman_previewtype":"html","body":"{\n  \"message\": \"dolore Excepteur\"\n}","code":404,"cookie":[],"header":[{"key":"Content-Type","value":"application/json"}],"id":"1231609a-7a3d-444d-aa0c-579703e618f4","name":"No spacecraft found for the provided `spacecraftId`","originalRequest":{"header":[{"description":"Added as a part of security scheme: apikey","key":"X-Api-Key","value":"<API Key>"}],"method":"GET","url":{"host":["https://api.getpostman.com"],"path":["spacecrafts",":spacecraftId"],"raw":"https://api.getpostman.com/spacecrafts/:spacecraftId","variable":[{"description":"(Required) The unique identifier of the spacecraft","key":"spacecraftId","value":"<string>"}]}},"responseTime":null,"status":"Not Found"},{"_postman_previewlanguage":"json","_postman_previewtype":"html","body":"{\n  \"message\": \"dolore Excepteur\"\n}","code":500,"cookie":[],"header":[{"key":"Content-Type","value":"application/json"}],"id":"db674465-8cec-4208-9724-42278ca9b83c","name":"Unexpected error","originalRequest":{"header":[{"description":"Added as a part of security scheme: apikey","key":"X-Api-Key","value":"<API Key>"}],"method":"GET","url":{"host":["https://api.getpostman.com"],"path":["spacecrafts",":spacecraftId"],"raw":"https://api.getpostman.com/spacecrafts/:spacecraftId","variable":[{"description":"(Required) The unique identifier of the spacecraft","key":"spacecraftId","value":"<string>"}]}},"responseTime":null,"status":"Internal Server Error"}]}],"variable":[{"id":"526a20ba-acfb-4549-a841-8edf2d24b929","key":"baseUrl","type":"string","value":"/"}]},"operationType":"CREATE_NEW"}'
};

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

```go Add a New Collection
package main

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

func main() {

	url := "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections"

	payload := strings.NewReader("{\n  \"data\": {\n    \"auth\": {\n      \"apikey\": [\n        {\n          \"key\": \"key\",\n          \"value\": \"X-Api-Key\"\n        },\n        {\n          \"key\": \"value\",\n          \"value\": \"{{apiKey}}\"\n        },\n        {\n          \"key\": \"in\",\n          \"value\": \"header\"\n        }\n      ],\n      \"type\": \"apikey\"\n    },\n    \"info\": {\n      \"_postman_id\": \"e726de58-f1b3-4edd-a8a7-2579dc799d39\",\n      \"description\": \"Buy or rent spacecrafts\",\n      \"name\": \"Generated\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\"\n    },\n    \"item\": [\n      {\n        \"id\": \"d3779255-5293-4e58-9b65-8954936e1dca\",\n        \"name\": \"Read a spacecraft\",\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"request\": {\n          \"header\": [\n            {\n              \"key\": \"Accept\",\n              \"value\": \"application/json\"\n            }\n          ],\n          \"method\": \"GET\",\n          \"url\": {\n            \"host\": [\n              \"https://api.getpostman.com\"\n            ],\n            \"path\": [\n              \"spacecrafts\",\n              \":spacecraftId\"\n            ],\n            \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n            \"variable\": [\n              {\n                \"description\": \"(Required) The unique identifier of the spacecraft\",\n                \"key\": \"spacecraftId\",\n                \"value\": \"<string>\"\n              }\n            ]\n          }\n        },\n        \"response\": [\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"id\\\": \\\"<string>\\\",\\n  \\\"name\\\": \\\"commodo\\\",\\n  \\\"type\\\": \\\"capsule\\\",\\n  \\\"description\\\": \\\"pariatur dolo\\\"\\n}\",\n            \"code\": 200,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"54467f6e-71d7-43d5-acc0-48f948e38528\",\n            \"name\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"OK\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 404,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"1231609a-7a3d-444d-aa0c-579703e618f4\",\n            \"name\": \"No spacecraft found for the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Not Found\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 500,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"db674465-8cec-4208-9724-42278ca9b83c\",\n            \"name\": \"Unexpected error\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Internal Server Error\"\n          }\n        ]\n      }\n    ],\n    \"variable\": [\n      {\n        \"id\": \"526a20ba-acfb-4549-a841-8edf2d24b929\",\n        \"key\": \"baseUrl\",\n        \"type\": \"string\",\n        \"value\": \"/\"\n      }\n    ]\n  },\n  \"operationType\": \"CREATE_NEW\"\n}")

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

	req.Header.Add("Accept", "application/vnd.api.v10+json")
	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 New Collection
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")

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

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/vnd.api.v10+json'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"data\": {\n    \"auth\": {\n      \"apikey\": [\n        {\n          \"key\": \"key\",\n          \"value\": \"X-Api-Key\"\n        },\n        {\n          \"key\": \"value\",\n          \"value\": \"{{apiKey}}\"\n        },\n        {\n          \"key\": \"in\",\n          \"value\": \"header\"\n        }\n      ],\n      \"type\": \"apikey\"\n    },\n    \"info\": {\n      \"_postman_id\": \"e726de58-f1b3-4edd-a8a7-2579dc799d39\",\n      \"description\": \"Buy or rent spacecrafts\",\n      \"name\": \"Generated\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\"\n    },\n    \"item\": [\n      {\n        \"id\": \"d3779255-5293-4e58-9b65-8954936e1dca\",\n        \"name\": \"Read a spacecraft\",\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"request\": {\n          \"header\": [\n            {\n              \"key\": \"Accept\",\n              \"value\": \"application/json\"\n            }\n          ],\n          \"method\": \"GET\",\n          \"url\": {\n            \"host\": [\n              \"https://api.getpostman.com\"\n            ],\n            \"path\": [\n              \"spacecrafts\",\n              \":spacecraftId\"\n            ],\n            \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n            \"variable\": [\n              {\n                \"description\": \"(Required) The unique identifier of the spacecraft\",\n                \"key\": \"spacecraftId\",\n                \"value\": \"<string>\"\n              }\n            ]\n          }\n        },\n        \"response\": [\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"id\\\": \\\"<string>\\\",\\n  \\\"name\\\": \\\"commodo\\\",\\n  \\\"type\\\": \\\"capsule\\\",\\n  \\\"description\\\": \\\"pariatur dolo\\\"\\n}\",\n            \"code\": 200,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"54467f6e-71d7-43d5-acc0-48f948e38528\",\n            \"name\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"OK\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 404,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"1231609a-7a3d-444d-aa0c-579703e618f4\",\n            \"name\": \"No spacecraft found for the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Not Found\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 500,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"db674465-8cec-4208-9724-42278ca9b83c\",\n            \"name\": \"Unexpected error\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Internal Server Error\"\n          }\n        ]\n      }\n    ],\n    \"variable\": [\n      {\n        \"id\": \"526a20ba-acfb-4549-a841-8edf2d24b929\",\n        \"key\": \"baseUrl\",\n        \"type\": \"string\",\n        \"value\": \"/\"\n      }\n    ]\n  },\n  \"operationType\": \"CREATE_NEW\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")
  .header("Accept", "application/vnd.api.v10+json")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"data\": {\n    \"auth\": {\n      \"apikey\": [\n        {\n          \"key\": \"key\",\n          \"value\": \"X-Api-Key\"\n        },\n        {\n          \"key\": \"value\",\n          \"value\": \"{{apiKey}}\"\n        },\n        {\n          \"key\": \"in\",\n          \"value\": \"header\"\n        }\n      ],\n      \"type\": \"apikey\"\n    },\n    \"info\": {\n      \"_postman_id\": \"e726de58-f1b3-4edd-a8a7-2579dc799d39\",\n      \"description\": \"Buy or rent spacecrafts\",\n      \"name\": \"Generated\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\"\n    },\n    \"item\": [\n      {\n        \"id\": \"d3779255-5293-4e58-9b65-8954936e1dca\",\n        \"name\": \"Read a spacecraft\",\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"request\": {\n          \"header\": [\n            {\n              \"key\": \"Accept\",\n              \"value\": \"application/json\"\n            }\n          ],\n          \"method\": \"GET\",\n          \"url\": {\n            \"host\": [\n              \"https://api.getpostman.com\"\n            ],\n            \"path\": [\n              \"spacecrafts\",\n              \":spacecraftId\"\n            ],\n            \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n            \"variable\": [\n              {\n                \"description\": \"(Required) The unique identifier of the spacecraft\",\n                \"key\": \"spacecraftId\",\n                \"value\": \"<string>\"\n              }\n            ]\n          }\n        },\n        \"response\": [\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"id\\\": \\\"<string>\\\",\\n  \\\"name\\\": \\\"commodo\\\",\\n  \\\"type\\\": \\\"capsule\\\",\\n  \\\"description\\\": \\\"pariatur dolo\\\"\\n}\",\n            \"code\": 200,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"54467f6e-71d7-43d5-acc0-48f948e38528\",\n            \"name\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"OK\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 404,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"1231609a-7a3d-444d-aa0c-579703e618f4\",\n            \"name\": \"No spacecraft found for the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Not Found\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 500,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"db674465-8cec-4208-9724-42278ca9b83c\",\n            \"name\": \"Unexpected error\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Internal Server Error\"\n          }\n        ]\n      }\n    ],\n    \"variable\": [\n      {\n        \"id\": \"526a20ba-acfb-4549-a841-8edf2d24b929\",\n        \"key\": \"baseUrl\",\n        \"type\": \"string\",\n        \"value\": \"/\"\n      }\n    ]\n  },\n  \"operationType\": \"CREATE_NEW\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections', [
  'body' => '{
  "data": {
    "auth": {
      "apikey": [
        {
          "key": "key",
          "value": "X-Api-Key"
        },
        {
          "key": "value",
          "value": "{{apiKey}}"
        },
        {
          "key": "in",
          "value": "header"
        }
      ],
      "type": "apikey"
    },
    "info": {
      "_postman_id": "e726de58-f1b3-4edd-a8a7-2579dc799d39",
      "description": "Buy or rent spacecrafts",
      "name": "Generated",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
      {
        "id": "d3779255-5293-4e58-9b65-8954936e1dca",
        "name": "Read a spacecraft",
        "protocolProfileBehavior": {
          "disableBodyPruning": true
        },
        "request": {
          "header": [
            {
              "key": "Accept",
              "value": "application/json"
            }
          ],
          "method": "GET",
          "url": {
            "host": [
              "https://api.getpostman.com"
            ],
            "path": [
              "spacecrafts",
              ":spacecraftId"
            ],
            "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
            "variable": [
              {
                "description": "(Required) The unique identifier of the spacecraft",
                "key": "spacecraftId",
                "value": "<string>"
              }
            ]
          }
        },
        "response": [
          {
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{\\n  \\"id\\": \\"<string>\\",\\n  \\"name\\": \\"commodo\\",\\n  \\"type\\": \\"capsule\\",\\n  \\"description\\": \\"pariatur dolo\\"\\n}",
            "code": 200,
            "cookie": [],
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "id": "54467f6e-71d7-43d5-acc0-48f948e38528",
            "name": "The spacecraft corresponding to the provided `spacecraftId`",
            "originalRequest": {
              "header": [
                {
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                }
              ],
              "method": "GET",
              "url": {
                "host": [
                  "https://api.getpostman.com"
                ],
                "path": [
                  "spacecrafts",
                  ":spacecraftId"
                ],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  {
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  }
                ]
              }
            },
            "responseTime": null,
            "status": "OK"
          },
          {
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{\\n  \\"message\\": \\"dolore Excepteur\\"\\n}",
            "code": 404,
            "cookie": [],
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "id": "1231609a-7a3d-444d-aa0c-579703e618f4",
            "name": "No spacecraft found for the provided `spacecraftId`",
            "originalRequest": {
              "header": [
                {
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                }
              ],
              "method": "GET",
              "url": {
                "host": [
                  "https://api.getpostman.com"
                ],
                "path": [
                  "spacecrafts",
                  ":spacecraftId"
                ],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  {
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  }
                ]
              }
            },
            "responseTime": null,
            "status": "Not Found"
          },
          {
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{\\n  \\"message\\": \\"dolore Excepteur\\"\\n}",
            "code": 500,
            "cookie": [],
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "id": "db674465-8cec-4208-9724-42278ca9b83c",
            "name": "Unexpected error",
            "originalRequest": {
              "header": [
                {
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                }
              ],
              "method": "GET",
              "url": {
                "host": [
                  "https://api.getpostman.com"
                ],
                "path": [
                  "spacecrafts",
                  ":spacecraftId"
                ],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  {
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  }
                ]
              }
            },
            "responseTime": null,
            "status": "Internal Server Error"
          }
        ]
      }
    ],
    "variable": [
      {
        "id": "526a20ba-acfb-4549-a841-8edf2d24b929",
        "key": "baseUrl",
        "type": "string",
        "value": "/"
      }
    ]
  },
  "operationType": "CREATE_NEW"
}',
  'headers' => [
    'Accept' => 'application/vnd.api.v10+json',
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Add a New Collection
using RestSharp;

var client = new RestClient("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/vnd.api.v10+json");
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"data\": {\n    \"auth\": {\n      \"apikey\": [\n        {\n          \"key\": \"key\",\n          \"value\": \"X-Api-Key\"\n        },\n        {\n          \"key\": \"value\",\n          \"value\": \"{{apiKey}}\"\n        },\n        {\n          \"key\": \"in\",\n          \"value\": \"header\"\n        }\n      ],\n      \"type\": \"apikey\"\n    },\n    \"info\": {\n      \"_postman_id\": \"e726de58-f1b3-4edd-a8a7-2579dc799d39\",\n      \"description\": \"Buy or rent spacecrafts\",\n      \"name\": \"Generated\",\n      \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\"\n    },\n    \"item\": [\n      {\n        \"id\": \"d3779255-5293-4e58-9b65-8954936e1dca\",\n        \"name\": \"Read a spacecraft\",\n        \"protocolProfileBehavior\": {\n          \"disableBodyPruning\": true\n        },\n        \"request\": {\n          \"header\": [\n            {\n              \"key\": \"Accept\",\n              \"value\": \"application/json\"\n            }\n          ],\n          \"method\": \"GET\",\n          \"url\": {\n            \"host\": [\n              \"https://api.getpostman.com\"\n            ],\n            \"path\": [\n              \"spacecrafts\",\n              \":spacecraftId\"\n            ],\n            \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n            \"variable\": [\n              {\n                \"description\": \"(Required) The unique identifier of the spacecraft\",\n                \"key\": \"spacecraftId\",\n                \"value\": \"<string>\"\n              }\n            ]\n          }\n        },\n        \"response\": [\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"id\\\": \\\"<string>\\\",\\n  \\\"name\\\": \\\"commodo\\\",\\n  \\\"type\\\": \\\"capsule\\\",\\n  \\\"description\\\": \\\"pariatur dolo\\\"\\n}\",\n            \"code\": 200,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"54467f6e-71d7-43d5-acc0-48f948e38528\",\n            \"name\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"OK\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 404,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"1231609a-7a3d-444d-aa0c-579703e618f4\",\n            \"name\": \"No spacecraft found for the provided `spacecraftId`\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Not Found\"\n          },\n          {\n            \"_postman_previewlanguage\": \"json\",\n            \"_postman_previewtype\": \"html\",\n            \"body\": \"{\\n  \\\"message\\\": \\\"dolore Excepteur\\\"\\n}\",\n            \"code\": 500,\n            \"cookie\": [],\n            \"header\": [\n              {\n                \"key\": \"Content-Type\",\n                \"value\": \"application/json\"\n              }\n            ],\n            \"id\": \"db674465-8cec-4208-9724-42278ca9b83c\",\n            \"name\": \"Unexpected error\",\n            \"originalRequest\": {\n              \"header\": [\n                {\n                  \"description\": \"Added as a part of security scheme: apikey\",\n                  \"key\": \"X-Api-Key\",\n                  \"value\": \"<API Key>\"\n                }\n              ],\n              \"method\": \"GET\",\n              \"url\": {\n                \"host\": [\n                  \"https://api.getpostman.com\"\n                ],\n                \"path\": [\n                  \"spacecrafts\",\n                  \":spacecraftId\"\n                ],\n                \"raw\": \"https://api.getpostman.com/spacecrafts/:spacecraftId\",\n                \"variable\": [\n                  {\n                    \"description\": \"(Required) The unique identifier of the spacecraft\",\n                    \"key\": \"spacecraftId\",\n                    \"value\": \"<string>\"\n                  }\n                ]\n              }\n            },\n            \"responseTime\": null,\n            \"status\": \"Internal Server Error\"\n          }\n        ]\n      }\n    ],\n    \"variable\": [\n      {\n        \"id\": \"526a20ba-acfb-4549-a841-8edf2d24b929\",\n        \"key\": \"baseUrl\",\n        \"type\": \"string\",\n        \"value\": \"/\"\n      }\n    ]\n  },\n  \"operationType\": \"CREATE_NEW\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a New Collection
import Foundation

let headers = [
  "Accept": "application/vnd.api.v10+json",
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "data": [
    "auth": [
      "apikey": [
        [
          "key": "key",
          "value": "X-Api-Key"
        ],
        [
          "key": "value",
          "value": "{{apiKey}}"
        ],
        [
          "key": "in",
          "value": "header"
        ]
      ],
      "type": "apikey"
    ],
    "info": [
      "_postman_id": "e726de58-f1b3-4edd-a8a7-2579dc799d39",
      "description": "Buy or rent spacecrafts",
      "name": "Generated",
      "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    ],
    "item": [
      [
        "id": "d3779255-5293-4e58-9b65-8954936e1dca",
        "name": "Read a spacecraft",
        "protocolProfileBehavior": ["disableBodyPruning": true],
        "request": [
          "header": [
            [
              "key": "Accept",
              "value": "application/json"
            ]
          ],
          "method": "GET",
          "url": [
            "host": ["https://api.getpostman.com"],
            "path": ["spacecrafts", ":spacecraftId"],
            "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
            "variable": [
              [
                "description": "(Required) The unique identifier of the spacecraft",
                "key": "spacecraftId",
                "value": "<string>"
              ]
            ]
          ]
        ],
        "response": [
          [
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{
  \"id\": \"<string>\",
  \"name\": \"commodo\",
  \"type\": \"capsule\",
  \"description\": \"pariatur dolo\"
}",
            "code": 200,
            "cookie": [],
            "header": [
              [
                "key": "Content-Type",
                "value": "application/json"
              ]
            ],
            "id": "54467f6e-71d7-43d5-acc0-48f948e38528",
            "name": "The spacecraft corresponding to the provided `spacecraftId`",
            "originalRequest": [
              "header": [
                [
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                ]
              ],
              "method": "GET",
              "url": [
                "host": ["https://api.getpostman.com"],
                "path": ["spacecrafts", ":spacecraftId"],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  [
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  ]
                ]
              ]
            ],
            "responseTime": ,
            "status": "OK"
          ],
          [
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{
  \"message\": \"dolore Excepteur\"
}",
            "code": 404,
            "cookie": [],
            "header": [
              [
                "key": "Content-Type",
                "value": "application/json"
              ]
            ],
            "id": "1231609a-7a3d-444d-aa0c-579703e618f4",
            "name": "No spacecraft found for the provided `spacecraftId`",
            "originalRequest": [
              "header": [
                [
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                ]
              ],
              "method": "GET",
              "url": [
                "host": ["https://api.getpostman.com"],
                "path": ["spacecrafts", ":spacecraftId"],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  [
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  ]
                ]
              ]
            ],
            "responseTime": ,
            "status": "Not Found"
          ],
          [
            "_postman_previewlanguage": "json",
            "_postman_previewtype": "html",
            "body": "{
  \"message\": \"dolore Excepteur\"
}",
            "code": 500,
            "cookie": [],
            "header": [
              [
                "key": "Content-Type",
                "value": "application/json"
              ]
            ],
            "id": "db674465-8cec-4208-9724-42278ca9b83c",
            "name": "Unexpected error",
            "originalRequest": [
              "header": [
                [
                  "description": "Added as a part of security scheme: apikey",
                  "key": "X-Api-Key",
                  "value": "<API Key>"
                ]
              ],
              "method": "GET",
              "url": [
                "host": ["https://api.getpostman.com"],
                "path": ["spacecrafts", ":spacecraftId"],
                "raw": "https://api.getpostman.com/spacecrafts/:spacecraftId",
                "variable": [
                  [
                    "description": "(Required) The unique identifier of the spacecraft",
                    "key": "spacecraftId",
                    "value": "<string>"
                  ]
                ]
              ]
            ],
            "responseTime": ,
            "status": "Internal Server Error"
          ]
        ]
      ]
    ],
    "variable": [
      [
        "id": "526a20ba-acfb-4549-a841-8edf2d24b929",
        "key": "baseUrl",
        "type": "string",
        "value": "/"
      ]
    ]
  ],
  "operationType": "CREATE_NEW"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/collections")! 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()
```