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

# Create a spec

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

Creates an API specification in Postman's [Spec Hub](https://learning.postman.com/docs/design-apis/specifications/overview/). Specifications can be single or multi-file.

**Note:**
- Postman supports OpenAPI (2.0, 3.0, and 3.1), AsyncAPI (2.0 and 3.0), protobuf (2 and 3), GraphQL, and Smithy specifications.
- If the file path contains a `/` (forward slash) character, then a folder is created. For example, if the path is the `components/schemas.json` value, then a `components` folder is created with the `schemas.json` file inside.
- Multi-file specifications can only have one root file.
- Files cannot exceed a maximum of 12 MB in size.


Reference: https://learning.postman.com/api-docs/api-reference/specs/create-spec

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /specs:
    post:
      operationId: createSpec
      summary: Create a spec
      description: >
        Creates an API specification in Postman's [Spec
        Hub](https://learning.postman.com/docs/design-apis/specifications/overview/).
        Specifications can be single or multi-file.


        **Note:**

        - Postman supports OpenAPI (2.0, 3.0, and 3.1), AsyncAPI (2.0 and 3.0),
        protobuf (2 and 3), GraphQL, and Smithy specifications.

        - If the file path contains a `/` (forward slash) character, then a
        folder is created. For example, if the path is the
        `components/schemas.json` value, then a `components` folder is created
        with the `schemas.json` file inside.

        - Multi-file specifications can only have one root file.

        - Files cannot exceed a maximum of 12 MB in size.
      tags:
        - specs
      parameters:
        - name: workspaceId
          in: query
          description: The workspace's ID.
          required: true
          schema:
            $ref: '#/components/schemas/workspaceId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createSpecResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSpecRequestForbiddenError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSpecRequestInternalServerError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createSpec'
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:
    workspaceId:
      type: string
      title: workspaceId
    specType:
      type: string
      enum:
        - OPENAPI:2.0
        - OPENAPI:3.0
        - OPENAPI:3.1
        - ASYNCAPI:2.0
        - ASYNCAPI:3.0
        - PROTOBUF:2
        - PROTOBUF:3
        - GRAPHQL
        - SMITHY:2.0
      description: The type of API specification.
      title: specType
    CreateSpecFilesItemsOneOf0Type:
      type: string
      enum:
        - DEFAULT
        - ROOT
      description: >
        The type of file. This property is required when creating multi-file
        specifications:

        - `ROOT` — The file containing the full OpenAPI structure. This serves
        as the entry point for the API spec and references other (`DEFAULT`)
        spec files. Multi-file specs can only have one root file.

        - `DEFAULT` — A file referenced by the `ROOT` file.
      title: CreateSpecFilesItemsOneOf0Type
    CreateSpecFilesItems0:
      type: object
      properties:
        path:
          type: string
          description: The file's path. Accepts .json, .yaml, and .proto types.
        content:
          type: string
          description: The file's stringified contents.
        type:
          $ref: '#/components/schemas/CreateSpecFilesItemsOneOf0Type'
          description: >
            The type of file. This property is required when creating multi-file
            specifications:

            - `ROOT` — The file containing the full OpenAPI structure. This
            serves as the entry point for the API spec and references other
            (`DEFAULT`) spec files. Multi-file specs can only have one root
            file.

            - `DEFAULT` — A file referenced by the `ROOT` file.
      required:
        - path
        - content
        - type
      title: CreateSpecFilesItems0
    CreateSpecFilesItems1:
      type: object
      properties:
        path:
          type: string
          description: >-
            The file's path. Accepts .json, .yaml, .proto, .graphql, and .smithy
            file types.
        content:
          type: string
          description: The file's stringified contents.
      required:
        - path
        - content
      title: CreateSpecFilesItems1
    CreateSpecFilesItems:
      oneOf:
        - $ref: '#/components/schemas/CreateSpecFilesItems0'
        - $ref: '#/components/schemas/CreateSpecFilesItems1'
      title: CreateSpecFilesItems
    createSpec:
      type: object
      properties:
        name:
          type: string
          description: The specification's name.
        type:
          $ref: '#/components/schemas/specType'
        files:
          type: array
          items:
            $ref: '#/components/schemas/CreateSpecFilesItems'
          description: A list of the specification's files and their contents.
      required:
        - name
        - type
        - files
      title: createSpec
    createSpecResponse:
      type: object
      properties:
        name:
          type: string
          description: The API specification's name.
        type:
          $ref: '#/components/schemas/specType'
        id:
          type: string
          description: The specification's ID.
        createdAt:
          type: string
          format: date-time
          description: The date and time at which the specification file was created.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the file was last updated.
        createdBy:
          type: integer
          description: The user ID of the user that created the file.
        updatedBy:
          type: integer
          description: The user ID of the user that last updated the specification file.
      title: createSpecResponse
    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
    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
    CreateSpecRequestForbiddenError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
      title: CreateSpecRequestForbiddenError
    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
    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
    CreateSpecRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: CreateSpecRequestInternalServerError
  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

### Spec Created



**Request**

```json
undefined
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Spec Created
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Spec Created
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'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 Spec Created
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

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

	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 Spec Created
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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'

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

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

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Spec Created
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Spec Created
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create OpenAPI JSON Spec



**Request**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    {
      "content": "{\n  \"openapi\": \"3.0.0\",\n  \"info\": {\n    \"version\": \"1.0.0\",\n    \"title\": \"Sample API\",\n    \"description\": \"Buy or rent spacecrafts\"\n  },\n  \"paths\": {\n    \"/spacecrafts/{spacecraftId}\": {\n      \"parameters\": [\n        {\n          \"name\": \"spacecraftId\",\n          \"description\": \"The unique identifier of the spacecraft\",\n          \"in\": \"path\",\n          \"required\": true,\n          \"schema\": {\n            \"$ref\": \"#/components/schemas/SpacecraftId\"\n          }\n        }\n      ],\n      \"get\": {\n        \"summary\": \"Read a spacecraft\",\n        \"responses\": {\n          \"200\": {\n            \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n            \"content\": {\n              \"application/json\": {\n                \"schema\": {\n                  \"$ref\": \"#/components/schemas/Spacecraft\"\n                }\n              }\n            }\n          },\n          \"404\": {\n            \"description\": \"No spacecraft found for the provided `spacecraftId`\",\n            \"content\": {\n              \"application/json\": {\n                \"schema\": {\n                  \"$ref\": \"#/components/schemas/Error\"\n                }\n              }\n            }\n          },\n          \"500\": {\n            \"description\": \"Unexpected error\",\n            \"content\": {\n              \"application/json\": {\n                \"schema\": {\n                  \"$ref\": \"#/components/schemas/Error\"\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  },\n  \"components\": {\n    \"schemas\": {\n      \"SpacecraftId\": {\n        \"description\": \"The unique identifier of a spacecraft\",\n        \"type\": \"string\"\n      },\n      \"Spacecraft\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"id\",\n          \"name\",\n          \"type\"\n        ],\n        \"properties\": {\n          \"id\": {\n            \"$ref\": \"#/components/schemas/SpacecraftId\"\n          },\n          \"name\": {\n            \"type\": \"string\"\n          },\n          \"type\": {\n            \"type\": \"string\",\n            \"enum\": [\n              \"capsule\",\n              \"probe\",\n              \"satellite\",\n              \"spaceplane\",\n              \"station\"\n            ]\n          },\n          \"description\": {\n            \"type\": \"string\"\n          }\n        }\n      },\n      \"Error\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"message\"\n        ],\n        \"properties\": {\n          \"message\": {\n            \"description\": \"A human readable error message\",\n            \"type\": \"string\"\n          }\n        }\n      }\n    },\n    \"securitySchemes\": {\n      \"ApiKey\": {\n        \"type\": \"apiKey\",\n        \"in\": \"header\",\n        \"name\": \"X-Api-Key\"\n      }\n    }\n  },\n  \"security\": [\n    {\n      \"ApiKey\": [\n\n      ]\n    }\n  ]\n}",
      "path": "index.json",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create OpenAPI JSON Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Sample API",
    "type": "OPENAPI:3.0",
    "files": [
        {
            "content": "{
  \"openapi\": \"3.0.0\",
  \"info\": {
    \"version\": \"1.0.0\",
    \"title\": \"Sample API\",
    \"description\": \"Buy or rent spacecrafts\"
  },
  \"paths\": {
    \"/spacecrafts/{spacecraftId}\": {
      \"parameters\": [
        {
          \"name\": \"spacecraftId\",
          \"description\": \"The unique identifier of the spacecraft\",
          \"in\": \"path\",
          \"required\": true,
          \"schema\": {
            \"$ref\": \"#/components/schemas/SpacecraftId\"
          }
        }
      ],
      \"get\": {
        \"summary\": \"Read a spacecraft\",
        \"responses\": {
          \"200\": {
            \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",
            \"content\": {
              \"application/json\": {
                \"schema\": {
                  \"$ref\": \"#/components/schemas/Spacecraft\"
                }
              }
            }
          },
          \"404\": {
            \"description\": \"No spacecraft found for the provided `spacecraftId`\",
            \"content\": {
              \"application/json\": {
                \"schema\": {
                  \"$ref\": \"#/components/schemas/Error\"
                }
              }
            }
          },
          \"500\": {
            \"description\": \"Unexpected error\",
            \"content\": {
              \"application/json\": {
                \"schema\": {
                  \"$ref\": \"#/components/schemas/Error\"
                }
              }
            }
          }
        }
      }
    }
  },
  \"components\": {
    \"schemas\": {
      \"SpacecraftId\": {
        \"description\": \"The unique identifier of a spacecraft\",
        \"type\": \"string\"
      },
      \"Spacecraft\": {
        \"type\": \"object\",
        \"required\": [
          \"id\",
          \"name\",
          \"type\"
        ],
        \"properties\": {
          \"id\": {
            \"$ref\": \"#/components/schemas/SpacecraftId\"
          },
          \"name\": {
            \"type\": \"string\"
          },
          \"type\": {
            \"type\": \"string\",
            \"enum\": [
              \"capsule\",
              \"probe\",
              \"satellite\",
              \"spaceplane\",
              \"station\"
            ]
          },
          \"description\": {
            \"type\": \"string\"
          }
        }
      },
      \"Error\": {
        \"type\": \"object\",
        \"required\": [
          \"message\"
        ],
        \"properties\": {
          \"message\": {
            \"description\": \"A human readable error message\",
            \"type\": \"string\"
          }
        }
      }
    },
    \"securitySchemes\": {
      \"ApiKey\": {
        \"type\": \"apiKey\",
        \"in\": \"header\",
        \"name\": \"X-Api-Key\"
      }
    }
  },
  \"security\": [
    {
      \"ApiKey\": [

      ]
    }
  ]
}",
            "path": "index.json",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create OpenAPI JSON Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Sample API","type":"OPENAPI:3.0","files":[{"content":"{\n  \"openapi\": \"3.0.0\",\n  \"info\": {\n    \"version\": \"1.0.0\",\n    \"title\": \"Sample API\",\n    \"description\": \"Buy or rent spacecrafts\"\n  },\n  \"paths\": {\n    \"/spacecrafts/{spacecraftId}\": {\n      \"parameters\": [\n        {\n          \"name\": \"spacecraftId\",\n          \"description\": \"The unique identifier of the spacecraft\",\n          \"in\": \"path\",\n          \"required\": true,\n          \"schema\": {\n            \"$ref\": \"#/components/schemas/SpacecraftId\"\n          }\n        }\n      ],\n      \"get\": {\n        \"summary\": \"Read a spacecraft\",\n        \"responses\": {\n          \"200\": {\n            \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n            \"content\": {\n              \"application/json\": {\n                \"schema\": {\n                  \"$ref\": \"#/components/schemas/Spacecraft\"\n                }\n              }\n            }\n          },\n          \"404\": {\n            \"description\": \"No spacecraft found for the provided `spacecraftId`\",\n            \"content\": {\n              \"application/json\": {\n                \"schema\": {\n                  \"$ref\": \"#/components/schemas/Error\"\n                }\n              }\n            }\n          },\n          \"500\": {\n            \"description\": \"Unexpected error\",\n            \"content\": {\n              \"application/json\": {\n                \"schema\": {\n                  \"$ref\": \"#/components/schemas/Error\"\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  },\n  \"components\": {\n    \"schemas\": {\n      \"SpacecraftId\": {\n        \"description\": \"The unique identifier of a spacecraft\",\n        \"type\": \"string\"\n      },\n      \"Spacecraft\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"id\",\n          \"name\",\n          \"type\"\n        ],\n        \"properties\": {\n          \"id\": {\n            \"$ref\": \"#/components/schemas/SpacecraftId\"\n          },\n          \"name\": {\n            \"type\": \"string\"\n          },\n          \"type\": {\n            \"type\": \"string\",\n            \"enum\": [\n              \"capsule\",\n              \"probe\",\n              \"satellite\",\n              \"spaceplane\",\n              \"station\"\n            ]\n          },\n          \"description\": {\n            \"type\": \"string\"\n          }\n        }\n      },\n      \"Error\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"message\"\n        ],\n        \"properties\": {\n          \"message\": {\n            \"description\": \"A human readable error message\",\n            \"type\": \"string\"\n          }\n        }\n      }\n    },\n    \"securitySchemes\": {\n      \"ApiKey\": {\n        \"type\": \"apiKey\",\n        \"in\": \"header\",\n        \"name\": \"X-Api-Key\"\n      }\n    }\n  },\n  \"security\": [\n    {\n      \"ApiKey\": [\n\n      ]\n    }\n  ]\n}","path":"index.json","type":"DEFAULT"}]}'
};

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

```go Create OpenAPI JSON Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"openapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"title\\\": \\\"Sample API\\\",\\n    \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n  },\\n  \\\"paths\\\": {\\n    \\\"/spacecrafts/{spacecraftId}\\\": {\\n      \\\"parameters\\\": [\\n        {\\n          \\\"name\\\": \\\"spacecraftId\\\",\\n          \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n          \\\"in\\\": \\\"path\\\",\\n          \\\"required\\\": true,\\n          \\\"schema\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          }\\n        }\\n      ],\\n      \\\"get\\\": {\\n        \\\"summary\\\": \\\"Read a spacecraft\\\",\\n        \\\"responses\\\": {\\n          \\\"200\\\": {\\n            \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Spacecraft\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"404\\\": {\\n            \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"500\\\": {\\n            \\\"description\\\": \\\"Unexpected error\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"schemas\\\": {\\n      \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n      },\\n      \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\",\\n          \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          },\\n          \\\"name\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          },\\n          \\\"type\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"enum\\\": [\\n              \\\"capsule\\\",\\n              \\\"probe\\\",\\n              \\\"satellite\\\",\\n              \\\"spaceplane\\\",\\n              \\\"station\\\"\\n            ]\\n          },\\n          \\\"description\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      },\\n      \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"message\\\": {\\n            \\\"description\\\": \\\"A human readable error message\\\",\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      }\\n    },\\n    \\\"securitySchemes\\\": {\\n      \\\"ApiKey\\\": {\\n        \\\"type\\\": \\\"apiKey\\\",\\n        \\\"in\\\": \\\"header\\\",\\n        \\\"name\\\": \\\"X-Api-Key\\\"\\n      }\\n    }\\n  },\\n  \\\"security\\\": [\\n    {\\n      \\\"ApiKey\\\": [\\n\\n      ]\\n    }\\n  ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\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 Create OpenAPI JSON Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"openapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"title\\\": \\\"Sample API\\\",\\n    \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n  },\\n  \\\"paths\\\": {\\n    \\\"/spacecrafts/{spacecraftId}\\\": {\\n      \\\"parameters\\\": [\\n        {\\n          \\\"name\\\": \\\"spacecraftId\\\",\\n          \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n          \\\"in\\\": \\\"path\\\",\\n          \\\"required\\\": true,\\n          \\\"schema\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          }\\n        }\\n      ],\\n      \\\"get\\\": {\\n        \\\"summary\\\": \\\"Read a spacecraft\\\",\\n        \\\"responses\\\": {\\n          \\\"200\\\": {\\n            \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Spacecraft\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"404\\\": {\\n            \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"500\\\": {\\n            \\\"description\\\": \\\"Unexpected error\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"schemas\\\": {\\n      \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n      },\\n      \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\",\\n          \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          },\\n          \\\"name\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          },\\n          \\\"type\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"enum\\\": [\\n              \\\"capsule\\\",\\n              \\\"probe\\\",\\n              \\\"satellite\\\",\\n              \\\"spaceplane\\\",\\n              \\\"station\\\"\\n            ]\\n          },\\n          \\\"description\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      },\\n      \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"message\\\": {\\n            \\\"description\\\": \\\"A human readable error message\\\",\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      }\\n    },\\n    \\\"securitySchemes\\\": {\\n      \\\"ApiKey\\\": {\\n        \\\"type\\\": \\\"apiKey\\\",\\n        \\\"in\\\": \\\"header\\\",\\n        \\\"name\\\": \\\"X-Api-Key\\\"\\n      }\\n    }\\n  },\\n  \\\"security\\\": [\\n    {\\n      \\\"ApiKey\\\": [\\n\\n      ]\\n    }\\n  ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create OpenAPI JSON Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"openapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"title\\\": \\\"Sample API\\\",\\n    \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n  },\\n  \\\"paths\\\": {\\n    \\\"/spacecrafts/{spacecraftId}\\\": {\\n      \\\"parameters\\\": [\\n        {\\n          \\\"name\\\": \\\"spacecraftId\\\",\\n          \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n          \\\"in\\\": \\\"path\\\",\\n          \\\"required\\\": true,\\n          \\\"schema\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          }\\n        }\\n      ],\\n      \\\"get\\\": {\\n        \\\"summary\\\": \\\"Read a spacecraft\\\",\\n        \\\"responses\\\": {\\n          \\\"200\\\": {\\n            \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Spacecraft\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"404\\\": {\\n            \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"500\\\": {\\n            \\\"description\\\": \\\"Unexpected error\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"schemas\\\": {\\n      \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n      },\\n      \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\",\\n          \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          },\\n          \\\"name\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          },\\n          \\\"type\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"enum\\\": [\\n              \\\"capsule\\\",\\n              \\\"probe\\\",\\n              \\\"satellite\\\",\\n              \\\"spaceplane\\\",\\n              \\\"station\\\"\\n            ]\\n          },\\n          \\\"description\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      },\\n      \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"message\\\": {\\n            \\\"description\\\": \\\"A human readable error message\\\",\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      }\\n    },\\n    \\\"securitySchemes\\\": {\\n      \\\"ApiKey\\\": {\\n        \\\"type\\\": \\\"apiKey\\\",\\n        \\\"in\\\": \\\"header\\\",\\n        \\\"name\\\": \\\"X-Api-Key\\\"\\n      }\\n    }\\n  },\\n  \\\"security\\\": [\\n    {\\n      \\\"ApiKey\\\": [\\n\\n      ]\\n    }\\n  ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create OpenAPI JSON Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    {
      "content": "{\\n  \\"openapi\\": \\"3.0.0\\",\\n  \\"info\\": {\\n    \\"version\\": \\"1.0.0\\",\\n    \\"title\\": \\"Sample API\\",\\n    \\"description\\": \\"Buy or rent spacecrafts\\"\\n  },\\n  \\"paths\\": {\\n    \\"/spacecrafts/{spacecraftId}\\": {\\n      \\"parameters\\": [\\n        {\\n          \\"name\\": \\"spacecraftId\\",\\n          \\"description\\": \\"The unique identifier of the spacecraft\\",\\n          \\"in\\": \\"path\\",\\n          \\"required\\": true,\\n          \\"schema\\": {\\n            \\"$ref\\": \\"#/components/schemas/SpacecraftId\\"\\n          }\\n        }\\n      ],\\n      \\"get\\": {\\n        \\"summary\\": \\"Read a spacecraft\\",\\n        \\"responses\\": {\\n          \\"200\\": {\\n            \\"description\\": \\"The spacecraft corresponding to the provided `spacecraftId`\\",\\n            \\"content\\": {\\n              \\"application/json\\": {\\n                \\"schema\\": {\\n                  \\"$ref\\": \\"#/components/schemas/Spacecraft\\"\\n                }\\n              }\\n            }\\n          },\\n          \\"404\\": {\\n            \\"description\\": \\"No spacecraft found for the provided `spacecraftId`\\",\\n            \\"content\\": {\\n              \\"application/json\\": {\\n                \\"schema\\": {\\n                  \\"$ref\\": \\"#/components/schemas/Error\\"\\n                }\\n              }\\n            }\\n          },\\n          \\"500\\": {\\n            \\"description\\": \\"Unexpected error\\",\\n            \\"content\\": {\\n              \\"application/json\\": {\\n                \\"schema\\": {\\n                  \\"$ref\\": \\"#/components/schemas/Error\\"\\n                }\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  },\\n  \\"components\\": {\\n    \\"schemas\\": {\\n      \\"SpacecraftId\\": {\\n        \\"description\\": \\"The unique identifier of a spacecraft\\",\\n        \\"type\\": \\"string\\"\\n      },\\n      \\"Spacecraft\\": {\\n        \\"type\\": \\"object\\",\\n        \\"required\\": [\\n          \\"id\\",\\n          \\"name\\",\\n          \\"type\\"\\n        ],\\n        \\"properties\\": {\\n          \\"id\\": {\\n            \\"$ref\\": \\"#/components/schemas/SpacecraftId\\"\\n          },\\n          \\"name\\": {\\n            \\"type\\": \\"string\\"\\n          },\\n          \\"type\\": {\\n            \\"type\\": \\"string\\",\\n            \\"enum\\": [\\n              \\"capsule\\",\\n              \\"probe\\",\\n              \\"satellite\\",\\n              \\"spaceplane\\",\\n              \\"station\\"\\n            ]\\n          },\\n          \\"description\\": {\\n            \\"type\\": \\"string\\"\\n          }\\n        }\\n      },\\n      \\"Error\\": {\\n        \\"type\\": \\"object\\",\\n        \\"required\\": [\\n          \\"message\\"\\n        ],\\n        \\"properties\\": {\\n          \\"message\\": {\\n            \\"description\\": \\"A human readable error message\\",\\n            \\"type\\": \\"string\\"\\n          }\\n        }\\n      }\\n    },\\n    \\"securitySchemes\\": {\\n      \\"ApiKey\\": {\\n        \\"type\\": \\"apiKey\\",\\n        \\"in\\": \\"header\\",\\n        \\"name\\": \\"X-Api-Key\\"\\n      }\\n    }\\n  },\\n  \\"security\\": [\\n    {\\n      \\"ApiKey\\": [\\n\\n      ]\\n    }\\n  ]\\n}",
      "path": "index.json",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create OpenAPI JSON Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"openapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"title\\\": \\\"Sample API\\\",\\n    \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n  },\\n  \\\"paths\\\": {\\n    \\\"/spacecrafts/{spacecraftId}\\\": {\\n      \\\"parameters\\\": [\\n        {\\n          \\\"name\\\": \\\"spacecraftId\\\",\\n          \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n          \\\"in\\\": \\\"path\\\",\\n          \\\"required\\\": true,\\n          \\\"schema\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          }\\n        }\\n      ],\\n      \\\"get\\\": {\\n        \\\"summary\\\": \\\"Read a spacecraft\\\",\\n        \\\"responses\\\": {\\n          \\\"200\\\": {\\n            \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Spacecraft\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"404\\\": {\\n            \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          },\\n          \\\"500\\\": {\\n            \\\"description\\\": \\\"Unexpected error\\\",\\n            \\\"content\\\": {\\n              \\\"application/json\\\": {\\n                \\\"schema\\\": {\\n                  \\\"$ref\\\": \\\"#/components/schemas/Error\\\"\\n                }\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"schemas\\\": {\\n      \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n      },\\n      \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\",\\n          \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"$ref\\\": \\\"#/components/schemas/SpacecraftId\\\"\\n          },\\n          \\\"name\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          },\\n          \\\"type\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"enum\\\": [\\n              \\\"capsule\\\",\\n              \\\"probe\\\",\\n              \\\"satellite\\\",\\n              \\\"spaceplane\\\",\\n              \\\"station\\\"\\n            ]\\n          },\\n          \\\"description\\\": {\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      },\\n      \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n          \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"message\\\": {\\n            \\\"description\\\": \\\"A human readable error message\\\",\\n            \\\"type\\\": \\\"string\\\"\\n          }\\n        }\\n      }\\n    },\\n    \\\"securitySchemes\\\": {\\n      \\\"ApiKey\\\": {\\n        \\\"type\\\": \\\"apiKey\\\",\\n        \\\"in\\\": \\\"header\\\",\\n        \\\"name\\\": \\\"X-Api-Key\\\"\\n      }\\n    }\\n  },\\n  \\\"security\\\": [\\n    {\\n      \\\"ApiKey\\\": [\\n\\n      ]\\n    }\\n  ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create OpenAPI JSON Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    [
      "content": "{
  \"openapi\": \"3.0.0\",
  \"info\": {
    \"version\": \"1.0.0\",
    \"title\": \"Sample API\",
    \"description\": \"Buy or rent spacecrafts\"
  },
  \"paths\": {
    \"/spacecrafts/{spacecraftId}\": {
      \"parameters\": [
        {
          \"name\": \"spacecraftId\",
          \"description\": \"The unique identifier of the spacecraft\",
          \"in\": \"path\",
          \"required\": true,
          \"schema\": {
            \"$ref\": \"#/components/schemas/SpacecraftId\"
          }
        }
      ],
      \"get\": {
        \"summary\": \"Read a spacecraft\",
        \"responses\": {
          \"200\": {
            \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",
            \"content\": {
              \"application/json\": {
                \"schema\": {
                  \"$ref\": \"#/components/schemas/Spacecraft\"
                }
              }
            }
          },
          \"404\": {
            \"description\": \"No spacecraft found for the provided `spacecraftId`\",
            \"content\": {
              \"application/json\": {
                \"schema\": {
                  \"$ref\": \"#/components/schemas/Error\"
                }
              }
            }
          },
          \"500\": {
            \"description\": \"Unexpected error\",
            \"content\": {
              \"application/json\": {
                \"schema\": {
                  \"$ref\": \"#/components/schemas/Error\"
                }
              }
            }
          }
        }
      }
    }
  },
  \"components\": {
    \"schemas\": {
      \"SpacecraftId\": {
        \"description\": \"The unique identifier of a spacecraft\",
        \"type\": \"string\"
      },
      \"Spacecraft\": {
        \"type\": \"object\",
        \"required\": [
          \"id\",
          \"name\",
          \"type\"
        ],
        \"properties\": {
          \"id\": {
            \"$ref\": \"#/components/schemas/SpacecraftId\"
          },
          \"name\": {
            \"type\": \"string\"
          },
          \"type\": {
            \"type\": \"string\",
            \"enum\": [
              \"capsule\",
              \"probe\",
              \"satellite\",
              \"spaceplane\",
              \"station\"
            ]
          },
          \"description\": {
            \"type\": \"string\"
          }
        }
      },
      \"Error\": {
        \"type\": \"object\",
        \"required\": [
          \"message\"
        ],
        \"properties\": {
          \"message\": {
            \"description\": \"A human readable error message\",
            \"type\": \"string\"
          }
        }
      }
    },
    \"securitySchemes\": {
      \"ApiKey\": {
        \"type\": \"apiKey\",
        \"in\": \"header\",
        \"name\": \"X-Api-Key\"
      }
    }
  },
  \"security\": [
    {
      \"ApiKey\": [

      ]
    }
  ]
}",
      "path": "index.json",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create OpenAPI YAML Spec



**Request**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    {
      "content": "openapi: \"3.0.0\"\ninfo:\n  version: \"1.0.0\"\n  title: \"Sample API\"\n  description: Buy or rent spacecrafts\n\npaths:\n  /spacecrafts/{spacecraftId}:\n    parameters:\n      - name: spacecraftId\n        description: The unique identifier of the spacecraft\n        in: path\n        required: true\n        schema:\n          $ref: \"#/components/schemas/SpacecraftId\"\n    get:\n      summary: Read a spacecraft\n      responses:\n        \"200\":\n          description: The spacecraft corresponding to the provided `spacecraftId`\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Spacecraft\"\n        404:\n          description: No spacecraft found for the provided `spacecraftId`\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        500:\n          description: Unexpected error\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\ncomponents:\n  schemas:\n    SpacecraftId:\n      description: The unique identifier of a spacecraft\n      type: string\n    Spacecraft:\n      type: object\n      required:\n        - id\n        - name\n        - type\n      properties:\n        id:\n          $ref: \"#/components/schemas/SpacecraftId\"\n        name:\n          type: string\n        type:\n          type: string\n          enum:\n            - capsule\n            - probe\n            - satellite\n            - spaceplane\n            - station\n        description:\n          type: string\n    Error:\n      type: object\n      required:\n        - message\n      properties:\n        message:\n          description: A human readable error message\n          type: string\n  securitySchemes:\n    ApiKey:\n      type: apiKey\n      in: header\n      name: X-Api-Key\nsecurity:\n  - ApiKey: []\n",
      "path": "index.yaml",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create OpenAPI YAML Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Sample API",
    "type": "OPENAPI:3.0",
    "files": [
        {
            "content": "openapi: \"3.0.0\"
info:
  version: \"1.0.0\"
  title: \"Sample API\"
  description: Buy or rent spacecrafts

paths:
  /spacecrafts/{spacecraftId}:
    parameters:
      - name: spacecraftId
        description: The unique identifier of the spacecraft
        in: path
        required: true
        schema:
          $ref: \"#/components/schemas/SpacecraftId\"
    get:
      summary: Read a spacecraft
      responses:
        \"200\":
          description: The spacecraft corresponding to the provided `spacecraftId`
          content:
            application/json:
              schema:
                $ref: \"#/components/schemas/Spacecraft\"
        404:
          description: No spacecraft found for the provided `spacecraftId`
          content:
            application/json:
              schema:
                $ref: \"#/components/schemas/Error\"
        500:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: \"#/components/schemas/Error\"
components:
  schemas:
    SpacecraftId:
      description: The unique identifier of a spacecraft
      type: string
    Spacecraft:
      type: object
      required:
        - id
        - name
        - type
      properties:
        id:
          $ref: \"#/components/schemas/SpacecraftId\"
        name:
          type: string
        type:
          type: string
          enum:
            - capsule
            - probe
            - satellite
            - spaceplane
            - station
        description:
          type: string
    Error:
      type: object
      required:
        - message
      properties:
        message:
          description: A human readable error message
          type: string
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
security:
  - ApiKey: []
",
            "path": "index.yaml",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create OpenAPI YAML Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Sample API","type":"OPENAPI:3.0","files":[{"content":"openapi: \"3.0.0\"\ninfo:\n  version: \"1.0.0\"\n  title: \"Sample API\"\n  description: Buy or rent spacecrafts\n\npaths:\n  /spacecrafts/{spacecraftId}:\n    parameters:\n      - name: spacecraftId\n        description: The unique identifier of the spacecraft\n        in: path\n        required: true\n        schema:\n          $ref: \"#/components/schemas/SpacecraftId\"\n    get:\n      summary: Read a spacecraft\n      responses:\n        \"200\":\n          description: The spacecraft corresponding to the provided `spacecraftId`\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Spacecraft\"\n        404:\n          description: No spacecraft found for the provided `spacecraftId`\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        500:\n          description: Unexpected error\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\ncomponents:\n  schemas:\n    SpacecraftId:\n      description: The unique identifier of a spacecraft\n      type: string\n    Spacecraft:\n      type: object\n      required:\n        - id\n        - name\n        - type\n      properties:\n        id:\n          $ref: \"#/components/schemas/SpacecraftId\"\n        name:\n          type: string\n        type:\n          type: string\n          enum:\n            - capsule\n            - probe\n            - satellite\n            - spaceplane\n            - station\n        description:\n          type: string\n    Error:\n      type: object\n      required:\n        - message\n      properties:\n        message:\n          description: A human readable error message\n          type: string\n  securitySchemes:\n    ApiKey:\n      type: apiKey\n      in: header\n      name: X-Api-Key\nsecurity:\n  - ApiKey: []\n","path":"index.yaml","type":"DEFAULT"}]}'
};

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

```go Create OpenAPI YAML Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"openapi: \\\"3.0.0\\\"\\ninfo:\\n  version: \\\"1.0.0\\\"\\n  title: \\\"Sample API\\\"\\n  description: Buy or rent spacecrafts\\n\\npaths:\\n  /spacecrafts/{spacecraftId}:\\n    parameters:\\n      - name: spacecraftId\\n        description: The unique identifier of the spacecraft\\n        in: path\\n        required: true\\n        schema:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n    get:\\n      summary: Read a spacecraft\\n      responses:\\n        \\\"200\\\":\\n          description: The spacecraft corresponding to the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Spacecraft\\\"\\n        404:\\n          description: No spacecraft found for the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\n        500:\\n          description: Unexpected error\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\ncomponents:\\n  schemas:\\n    SpacecraftId:\\n      description: The unique identifier of a spacecraft\\n      type: string\\n    Spacecraft:\\n      type: object\\n      required:\\n        - id\\n        - name\\n        - type\\n      properties:\\n        id:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n        name:\\n          type: string\\n        type:\\n          type: string\\n          enum:\\n            - capsule\\n            - probe\\n            - satellite\\n            - spaceplane\\n            - station\\n        description:\\n          type: string\\n    Error:\\n      type: object\\n      required:\\n        - message\\n      properties:\\n        message:\\n          description: A human readable error message\\n          type: string\\n  securitySchemes:\\n    ApiKey:\\n      type: apiKey\\n      in: header\\n      name: X-Api-Key\\nsecurity:\\n  - ApiKey: []\\n\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\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 Create OpenAPI YAML Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"openapi: \\\"3.0.0\\\"\\ninfo:\\n  version: \\\"1.0.0\\\"\\n  title: \\\"Sample API\\\"\\n  description: Buy or rent spacecrafts\\n\\npaths:\\n  /spacecrafts/{spacecraftId}:\\n    parameters:\\n      - name: spacecraftId\\n        description: The unique identifier of the spacecraft\\n        in: path\\n        required: true\\n        schema:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n    get:\\n      summary: Read a spacecraft\\n      responses:\\n        \\\"200\\\":\\n          description: The spacecraft corresponding to the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Spacecraft\\\"\\n        404:\\n          description: No spacecraft found for the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\n        500:\\n          description: Unexpected error\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\ncomponents:\\n  schemas:\\n    SpacecraftId:\\n      description: The unique identifier of a spacecraft\\n      type: string\\n    Spacecraft:\\n      type: object\\n      required:\\n        - id\\n        - name\\n        - type\\n      properties:\\n        id:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n        name:\\n          type: string\\n        type:\\n          type: string\\n          enum:\\n            - capsule\\n            - probe\\n            - satellite\\n            - spaceplane\\n            - station\\n        description:\\n          type: string\\n    Error:\\n      type: object\\n      required:\\n        - message\\n      properties:\\n        message:\\n          description: A human readable error message\\n          type: string\\n  securitySchemes:\\n    ApiKey:\\n      type: apiKey\\n      in: header\\n      name: X-Api-Key\\nsecurity:\\n  - ApiKey: []\\n\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create OpenAPI YAML Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"openapi: \\\"3.0.0\\\"\\ninfo:\\n  version: \\\"1.0.0\\\"\\n  title: \\\"Sample API\\\"\\n  description: Buy or rent spacecrafts\\n\\npaths:\\n  /spacecrafts/{spacecraftId}:\\n    parameters:\\n      - name: spacecraftId\\n        description: The unique identifier of the spacecraft\\n        in: path\\n        required: true\\n        schema:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n    get:\\n      summary: Read a spacecraft\\n      responses:\\n        \\\"200\\\":\\n          description: The spacecraft corresponding to the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Spacecraft\\\"\\n        404:\\n          description: No spacecraft found for the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\n        500:\\n          description: Unexpected error\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\ncomponents:\\n  schemas:\\n    SpacecraftId:\\n      description: The unique identifier of a spacecraft\\n      type: string\\n    Spacecraft:\\n      type: object\\n      required:\\n        - id\\n        - name\\n        - type\\n      properties:\\n        id:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n        name:\\n          type: string\\n        type:\\n          type: string\\n          enum:\\n            - capsule\\n            - probe\\n            - satellite\\n            - spaceplane\\n            - station\\n        description:\\n          type: string\\n    Error:\\n      type: object\\n      required:\\n        - message\\n      properties:\\n        message:\\n          description: A human readable error message\\n          type: string\\n  securitySchemes:\\n    ApiKey:\\n      type: apiKey\\n      in: header\\n      name: X-Api-Key\\nsecurity:\\n  - ApiKey: []\\n\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create OpenAPI YAML Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    {
      "content": "openapi: \\"3.0.0\\"\\ninfo:\\n  version: \\"1.0.0\\"\\n  title: \\"Sample API\\"\\n  description: Buy or rent spacecrafts\\n\\npaths:\\n  /spacecrafts/{spacecraftId}:\\n    parameters:\\n      - name: spacecraftId\\n        description: The unique identifier of the spacecraft\\n        in: path\\n        required: true\\n        schema:\\n          $ref: \\"#/components/schemas/SpacecraftId\\"\\n    get:\\n      summary: Read a spacecraft\\n      responses:\\n        \\"200\\":\\n          description: The spacecraft corresponding to the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\"#/components/schemas/Spacecraft\\"\\n        404:\\n          description: No spacecraft found for the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\"#/components/schemas/Error\\"\\n        500:\\n          description: Unexpected error\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\"#/components/schemas/Error\\"\\ncomponents:\\n  schemas:\\n    SpacecraftId:\\n      description: The unique identifier of a spacecraft\\n      type: string\\n    Spacecraft:\\n      type: object\\n      required:\\n        - id\\n        - name\\n        - type\\n      properties:\\n        id:\\n          $ref: \\"#/components/schemas/SpacecraftId\\"\\n        name:\\n          type: string\\n        type:\\n          type: string\\n          enum:\\n            - capsule\\n            - probe\\n            - satellite\\n            - spaceplane\\n            - station\\n        description:\\n          type: string\\n    Error:\\n      type: object\\n      required:\\n        - message\\n      properties:\\n        message:\\n          description: A human readable error message\\n          type: string\\n  securitySchemes:\\n    ApiKey:\\n      type: apiKey\\n      in: header\\n      name: X-Api-Key\\nsecurity:\\n  - ApiKey: []\\n",
      "path": "index.yaml",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create OpenAPI YAML Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"openapi: \\\"3.0.0\\\"\\ninfo:\\n  version: \\\"1.0.0\\\"\\n  title: \\\"Sample API\\\"\\n  description: Buy or rent spacecrafts\\n\\npaths:\\n  /spacecrafts/{spacecraftId}:\\n    parameters:\\n      - name: spacecraftId\\n        description: The unique identifier of the spacecraft\\n        in: path\\n        required: true\\n        schema:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n    get:\\n      summary: Read a spacecraft\\n      responses:\\n        \\\"200\\\":\\n          description: The spacecraft corresponding to the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Spacecraft\\\"\\n        404:\\n          description: No spacecraft found for the provided `spacecraftId`\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\n        500:\\n          description: Unexpected error\\n          content:\\n            application/json:\\n              schema:\\n                $ref: \\\"#/components/schemas/Error\\\"\\ncomponents:\\n  schemas:\\n    SpacecraftId:\\n      description: The unique identifier of a spacecraft\\n      type: string\\n    Spacecraft:\\n      type: object\\n      required:\\n        - id\\n        - name\\n        - type\\n      properties:\\n        id:\\n          $ref: \\\"#/components/schemas/SpacecraftId\\\"\\n        name:\\n          type: string\\n        type:\\n          type: string\\n          enum:\\n            - capsule\\n            - probe\\n            - satellite\\n            - spaceplane\\n            - station\\n        description:\\n          type: string\\n    Error:\\n      type: object\\n      required:\\n        - message\\n      properties:\\n        message:\\n          description: A human readable error message\\n          type: string\\n  securitySchemes:\\n    ApiKey:\\n      type: apiKey\\n      in: header\\n      name: X-Api-Key\\nsecurity:\\n  - ApiKey: []\\n\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create OpenAPI YAML Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    [
      "content": "openapi: \"3.0.0\"
info:
  version: \"1.0.0\"
  title: \"Sample API\"
  description: Buy or rent spacecrafts

paths:
  /spacecrafts/{spacecraftId}:
    parameters:
      - name: spacecraftId
        description: The unique identifier of the spacecraft
        in: path
        required: true
        schema:
          $ref: \"#/components/schemas/SpacecraftId\"
    get:
      summary: Read a spacecraft
      responses:
        \"200\":
          description: The spacecraft corresponding to the provided `spacecraftId`
          content:
            application/json:
              schema:
                $ref: \"#/components/schemas/Spacecraft\"
        404:
          description: No spacecraft found for the provided `spacecraftId`
          content:
            application/json:
              schema:
                $ref: \"#/components/schemas/Error\"
        500:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: \"#/components/schemas/Error\"
components:
  schemas:
    SpacecraftId:
      description: The unique identifier of a spacecraft
      type: string
    Spacecraft:
      type: object
      required:
        - id
        - name
        - type
      properties:
        id:
          $ref: \"#/components/schemas/SpacecraftId\"
        name:
          type: string
        type:
          type: string
          enum:
            - capsule
            - probe
            - satellite
            - spaceplane
            - station
        description:
          type: string
    Error:
      type: object
      required:
        - message
      properties:
        message:
          description: A human readable error message
          type: string
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
security:
  - ApiKey: []
",
      "path": "index.yaml",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create AsyncAPI 2.0 JSON Spec



**Request**

```json
{
  "name": "Streetlights API",
  "type": "ASYNCAPI:2.0",
  "files": [
    {
      "content": "{\n    \"asyncapi\": \"2.5.0\",\n    \"info\": {\n        \"title\": \"Streetlights API\",\n        \"version\": \"1.0.0\",\n        \"description\": \"The Smartylighting Streetlights API allows you\\nto remotely manage the city lights.\\n\",\n        \"license\": {\n            \"name\": \"Apache 2.0\",\n            \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n        },\n        \"contact\": {\n            \"name\": \"Streetlights API Developers\",\n            \"url\": \"https://example.com/contact\",\n            \"email\": \"contact@example.com\"\n        },\n        \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n    },\n    \"servers\": {\n        \"mosquitto\": {\n            \"url\": \"mqtt://test.mosquitto.org\",\n            \"protocol\": \"mqtt\"\n        }\n    },\n    \"channels\": {\n        \"light/measured\": {\n            \"publish\": {\n                \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\",\n                \"operationId\": \"onLightMeasured\",\n                \"message\": {\n                    \"name\": \"LightMeasured\",\n                    \"payload\": {\n                        \"$ref\": \"#/components/schemas/LightMeasuredPayloadSchema\"\n                    },\n                    \"examples\": [\n                        {\n                            \"payload\": {\n                                \"id\": 1,\n                                \"lumens\": 1,\n                                \"sentAt\": \"2023-09-01T18:00:00.000Z\"\n                            }\n                        }\n                    ]\n                }\n            }\n        }\n    },\n    \"components\": {\n        \"schemas\": {\n            \"LightMeasuredPayloadSchema\": {\n                \"type\": \"object\",\n                \"description\": \"Payload for LightMeasured API\",\n                \"required\": [\n                    \"id\",\n                    \"lumens\",\n                    \"sentAt\"\n                ],\n                \"properties\": {\n                    \"id\": {\n                        \"type\": \"integer\",\n                        \"minimum\": 0,\n                        \"description\": \"Id of the streetlight\"\n                    },\n                    \"lumens\": {\n                        \"type\": \"integer\",\n                        \"minimum\": 0,\n                        \"description\": \"Light intensity measured in lumens\"\n                    },\n                    \"sentAt\": {\n                        \"type\": \"string\",\n                        \"format\": \"date-time\",\n                        \"description\": \"Date and time when the message was sent\",\n                        \"minLength\": 20,\n                        \"maxLength\": 29\n                    }\n                }\n            }\n        }\n    }\n}",
      "path": "index.json",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create AsyncAPI 2.0 JSON Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Streetlights API",
    "type": "ASYNCAPI:2.0",
    "files": [
        {
            "content": "{
    \"asyncapi\": \"2.5.0\",
    \"info\": {
        \"title\": \"Streetlights API\",
        \"version\": \"1.0.0\",
        \"description\": \"The Smartylighting Streetlights API allows you\nto remotely manage the city lights.\n\",
        \"license\": {
            \"name\": \"Apache 2.0\",
            \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"
        },
        \"contact\": {
            \"name\": \"Streetlights API Developers\",
            \"url\": \"https://example.com/contact\",
            \"email\": \"contact@example.com\"
        },
        \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"
    },
    \"servers\": {
        \"mosquitto\": {
            \"url\": \"mqtt://test.mosquitto.org\",
            \"protocol\": \"mqtt\"
        }
    },
    \"channels\": {
        \"light/measured\": {
            \"publish\": {
                \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\",
                \"operationId\": \"onLightMeasured\",
                \"message\": {
                    \"name\": \"LightMeasured\",
                    \"payload\": {
                        \"$ref\": \"#/components/schemas/LightMeasuredPayloadSchema\"
                    },
                    \"examples\": [
                        {
                            \"payload\": {
                                \"id\": 1,
                                \"lumens\": 1,
                                \"sentAt\": \"2023-09-01T18:00:00.000Z\"
                            }
                        }
                    ]
                }
            }
        }
    },
    \"components\": {
        \"schemas\": {
            \"LightMeasuredPayloadSchema\": {
                \"type\": \"object\",
                \"description\": \"Payload for LightMeasured API\",
                \"required\": [
                    \"id\",
                    \"lumens\",
                    \"sentAt\"
                ],
                \"properties\": {
                    \"id\": {
                        \"type\": \"integer\",
                        \"minimum\": 0,
                        \"description\": \"Id of the streetlight\"
                    },
                    \"lumens\": {
                        \"type\": \"integer\",
                        \"minimum\": 0,
                        \"description\": \"Light intensity measured in lumens\"
                    },
                    \"sentAt\": {
                        \"type\": \"string\",
                        \"format\": \"date-time\",
                        \"description\": \"Date and time when the message was sent\",
                        \"minLength\": 20,
                        \"maxLength\": 29
                    }
                }
            }
        }
    }
}",
            "path": "index.json",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create AsyncAPI 2.0 JSON Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Streetlights API","type":"ASYNCAPI:2.0","files":[{"content":"{\n    \"asyncapi\": \"2.5.0\",\n    \"info\": {\n        \"title\": \"Streetlights API\",\n        \"version\": \"1.0.0\",\n        \"description\": \"The Smartylighting Streetlights API allows you\\nto remotely manage the city lights.\\n\",\n        \"license\": {\n            \"name\": \"Apache 2.0\",\n            \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n        },\n        \"contact\": {\n            \"name\": \"Streetlights API Developers\",\n            \"url\": \"https://example.com/contact\",\n            \"email\": \"contact@example.com\"\n        },\n        \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n    },\n    \"servers\": {\n        \"mosquitto\": {\n            \"url\": \"mqtt://test.mosquitto.org\",\n            \"protocol\": \"mqtt\"\n        }\n    },\n    \"channels\": {\n        \"light/measured\": {\n            \"publish\": {\n                \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\",\n                \"operationId\": \"onLightMeasured\",\n                \"message\": {\n                    \"name\": \"LightMeasured\",\n                    \"payload\": {\n                        \"$ref\": \"#/components/schemas/LightMeasuredPayloadSchema\"\n                    },\n                    \"examples\": [\n                        {\n                            \"payload\": {\n                                \"id\": 1,\n                                \"lumens\": 1,\n                                \"sentAt\": \"2023-09-01T18:00:00.000Z\"\n                            }\n                        }\n                    ]\n                }\n            }\n        }\n    },\n    \"components\": {\n        \"schemas\": {\n            \"LightMeasuredPayloadSchema\": {\n                \"type\": \"object\",\n                \"description\": \"Payload for LightMeasured API\",\n                \"required\": [\n                    \"id\",\n                    \"lumens\",\n                    \"sentAt\"\n                ],\n                \"properties\": {\n                    \"id\": {\n                        \"type\": \"integer\",\n                        \"minimum\": 0,\n                        \"description\": \"Id of the streetlight\"\n                    },\n                    \"lumens\": {\n                        \"type\": \"integer\",\n                        \"minimum\": 0,\n                        \"description\": \"Light intensity measured in lumens\"\n                    },\n                    \"sentAt\": {\n                        \"type\": \"string\",\n                        \"format\": \"date-time\",\n                        \"description\": \"Date and time when the message was sent\",\n                        \"minLength\": 20,\n                        \"maxLength\": 29\n                    }\n                }\n            }\n        }\n    }\n}","path":"index.json","type":"DEFAULT"}]}'
};

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

```go Create AsyncAPI 2.0 JSON Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"asyncapi\\\": \\\"2.5.0\\\",\\n    \\\"info\\\": {\\n        \\\"title\\\": \\\"Streetlights API\\\",\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n        \\\"license\\\": {\\n            \\\"name\\\": \\\"Apache 2.0\\\",\\n            \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n        },\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Streetlights API Developers\\\",\\n            \\\"url\\\": \\\"https://example.com/contact\\\",\\n            \\\"email\\\": \\\"contact@example.com\\\"\\n        },\\n        \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"servers\\\": {\\n        \\\"mosquitto\\\": {\\n            \\\"url\\\": \\\"mqtt://test.mosquitto.org\\\",\\n            \\\"protocol\\\": \\\"mqtt\\\"\\n        }\\n    },\\n    \\\"channels\\\": {\\n        \\\"light/measured\\\": {\\n            \\\"publish\\\": {\\n                \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\",\\n                \\\"operationId\\\": \\\"onLightMeasured\\\",\\n                \\\"message\\\": {\\n                    \\\"name\\\": \\\"LightMeasured\\\",\\n                    \\\"payload\\\": {\\n                        \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayloadSchema\\\"\\n                    },\\n                    \\\"examples\\\": [\\n                        {\\n                            \\\"payload\\\": {\\n                                \\\"id\\\": 1,\\n                                \\\"lumens\\\": 1,\\n                                \\\"sentAt\\\": \\\"2023-09-01T18:00:00.000Z\\\"\\n                            }\\n                        }\\n                    ]\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"schemas\\\": {\\n            \\\"LightMeasuredPayloadSchema\\\": {\\n                \\\"type\\\": \\\"object\\\",\\n                \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n                \\\"required\\\": [\\n                    \\\"id\\\",\\n                    \\\"lumens\\\",\\n                    \\\"sentAt\\\"\\n                ],\\n                \\\"properties\\\": {\\n                    \\\"id\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Id of the streetlight\\\"\\n                    },\\n                    \\\"lumens\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n                    },\\n                    \\\"sentAt\\\": {\\n                        \\\"type\\\": \\\"string\\\",\\n                        \\\"format\\\": \\\"date-time\\\",\\n                        \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n                        \\\"minLength\\\": 20,\\n                        \\\"maxLength\\\": 29\\n                    }\\n                }\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\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 Create AsyncAPI 2.0 JSON Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"asyncapi\\\": \\\"2.5.0\\\",\\n    \\\"info\\\": {\\n        \\\"title\\\": \\\"Streetlights API\\\",\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n        \\\"license\\\": {\\n            \\\"name\\\": \\\"Apache 2.0\\\",\\n            \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n        },\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Streetlights API Developers\\\",\\n            \\\"url\\\": \\\"https://example.com/contact\\\",\\n            \\\"email\\\": \\\"contact@example.com\\\"\\n        },\\n        \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"servers\\\": {\\n        \\\"mosquitto\\\": {\\n            \\\"url\\\": \\\"mqtt://test.mosquitto.org\\\",\\n            \\\"protocol\\\": \\\"mqtt\\\"\\n        }\\n    },\\n    \\\"channels\\\": {\\n        \\\"light/measured\\\": {\\n            \\\"publish\\\": {\\n                \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\",\\n                \\\"operationId\\\": \\\"onLightMeasured\\\",\\n                \\\"message\\\": {\\n                    \\\"name\\\": \\\"LightMeasured\\\",\\n                    \\\"payload\\\": {\\n                        \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayloadSchema\\\"\\n                    },\\n                    \\\"examples\\\": [\\n                        {\\n                            \\\"payload\\\": {\\n                                \\\"id\\\": 1,\\n                                \\\"lumens\\\": 1,\\n                                \\\"sentAt\\\": \\\"2023-09-01T18:00:00.000Z\\\"\\n                            }\\n                        }\\n                    ]\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"schemas\\\": {\\n            \\\"LightMeasuredPayloadSchema\\\": {\\n                \\\"type\\\": \\\"object\\\",\\n                \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n                \\\"required\\\": [\\n                    \\\"id\\\",\\n                    \\\"lumens\\\",\\n                    \\\"sentAt\\\"\\n                ],\\n                \\\"properties\\\": {\\n                    \\\"id\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Id of the streetlight\\\"\\n                    },\\n                    \\\"lumens\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n                    },\\n                    \\\"sentAt\\\": {\\n                        \\\"type\\\": \\\"string\\\",\\n                        \\\"format\\\": \\\"date-time\\\",\\n                        \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n                        \\\"minLength\\\": 20,\\n                        \\\"maxLength\\\": 29\\n                    }\\n                }\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create AsyncAPI 2.0 JSON Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"asyncapi\\\": \\\"2.5.0\\\",\\n    \\\"info\\\": {\\n        \\\"title\\\": \\\"Streetlights API\\\",\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n        \\\"license\\\": {\\n            \\\"name\\\": \\\"Apache 2.0\\\",\\n            \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n        },\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Streetlights API Developers\\\",\\n            \\\"url\\\": \\\"https://example.com/contact\\\",\\n            \\\"email\\\": \\\"contact@example.com\\\"\\n        },\\n        \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"servers\\\": {\\n        \\\"mosquitto\\\": {\\n            \\\"url\\\": \\\"mqtt://test.mosquitto.org\\\",\\n            \\\"protocol\\\": \\\"mqtt\\\"\\n        }\\n    },\\n    \\\"channels\\\": {\\n        \\\"light/measured\\\": {\\n            \\\"publish\\\": {\\n                \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\",\\n                \\\"operationId\\\": \\\"onLightMeasured\\\",\\n                \\\"message\\\": {\\n                    \\\"name\\\": \\\"LightMeasured\\\",\\n                    \\\"payload\\\": {\\n                        \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayloadSchema\\\"\\n                    },\\n                    \\\"examples\\\": [\\n                        {\\n                            \\\"payload\\\": {\\n                                \\\"id\\\": 1,\\n                                \\\"lumens\\\": 1,\\n                                \\\"sentAt\\\": \\\"2023-09-01T18:00:00.000Z\\\"\\n                            }\\n                        }\\n                    ]\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"schemas\\\": {\\n            \\\"LightMeasuredPayloadSchema\\\": {\\n                \\\"type\\\": \\\"object\\\",\\n                \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n                \\\"required\\\": [\\n                    \\\"id\\\",\\n                    \\\"lumens\\\",\\n                    \\\"sentAt\\\"\\n                ],\\n                \\\"properties\\\": {\\n                    \\\"id\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Id of the streetlight\\\"\\n                    },\\n                    \\\"lumens\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n                    },\\n                    \\\"sentAt\\\": {\\n                        \\\"type\\\": \\\"string\\\",\\n                        \\\"format\\\": \\\"date-time\\\",\\n                        \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n                        \\\"minLength\\\": 20,\\n                        \\\"maxLength\\\": 29\\n                    }\\n                }\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create AsyncAPI 2.0 JSON Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Streetlights API",
  "type": "ASYNCAPI:2.0",
  "files": [
    {
      "content": "{\\n    \\"asyncapi\\": \\"2.5.0\\",\\n    \\"info\\": {\\n        \\"title\\": \\"Streetlights API\\",\\n        \\"version\\": \\"1.0.0\\",\\n        \\"description\\": \\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\",\\n        \\"license\\": {\\n            \\"name\\": \\"Apache 2.0\\",\\n            \\"url\\": \\"https://www.apache.org/licenses/LICENSE-2.0\\"\\n        },\\n        \\"contact\\": {\\n            \\"name\\": \\"Streetlights API Developers\\",\\n            \\"url\\": \\"https://example.com/contact\\",\\n            \\"email\\": \\"contact@example.com\\"\\n        },\\n        \\"termsOfService\\": \\"https://www.apache.org/licenses/LICENSE-2.0\\"\\n    },\\n    \\"servers\\": {\\n        \\"mosquitto\\": {\\n            \\"url\\": \\"mqtt://test.mosquitto.org\\",\\n            \\"protocol\\": \\"mqtt\\"\\n        }\\n    },\\n    \\"channels\\": {\\n        \\"light/measured\\": {\\n            \\"publish\\": {\\n                \\"summary\\": \\"Inform about environmental lighting conditions for a particular streetlight\\",\\n                \\"operationId\\": \\"onLightMeasured\\",\\n                \\"message\\": {\\n                    \\"name\\": \\"LightMeasured\\",\\n                    \\"payload\\": {\\n                        \\"$ref\\": \\"#/components/schemas/LightMeasuredPayloadSchema\\"\\n                    },\\n                    \\"examples\\": [\\n                        {\\n                            \\"payload\\": {\\n                                \\"id\\": 1,\\n                                \\"lumens\\": 1,\\n                                \\"sentAt\\": \\"2023-09-01T18:00:00.000Z\\"\\n                            }\\n                        }\\n                    ]\\n                }\\n            }\\n        }\\n    },\\n    \\"components\\": {\\n        \\"schemas\\": {\\n            \\"LightMeasuredPayloadSchema\\": {\\n                \\"type\\": \\"object\\",\\n                \\"description\\": \\"Payload for LightMeasured API\\",\\n                \\"required\\": [\\n                    \\"id\\",\\n                    \\"lumens\\",\\n                    \\"sentAt\\"\\n                ],\\n                \\"properties\\": {\\n                    \\"id\\": {\\n                        \\"type\\": \\"integer\\",\\n                        \\"minimum\\": 0,\\n                        \\"description\\": \\"Id of the streetlight\\"\\n                    },\\n                    \\"lumens\\": {\\n                        \\"type\\": \\"integer\\",\\n                        \\"minimum\\": 0,\\n                        \\"description\\": \\"Light intensity measured in lumens\\"\\n                    },\\n                    \\"sentAt\\": {\\n                        \\"type\\": \\"string\\",\\n                        \\"format\\": \\"date-time\\",\\n                        \\"description\\": \\"Date and time when the message was sent\\",\\n                        \\"minLength\\": 20,\\n                        \\"maxLength\\": 29\\n                    }\\n                }\\n            }\\n        }\\n    }\\n}",
      "path": "index.json",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create AsyncAPI 2.0 JSON Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"asyncapi\\\": \\\"2.5.0\\\",\\n    \\\"info\\\": {\\n        \\\"title\\\": \\\"Streetlights API\\\",\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n        \\\"license\\\": {\\n            \\\"name\\\": \\\"Apache 2.0\\\",\\n            \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n        },\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Streetlights API Developers\\\",\\n            \\\"url\\\": \\\"https://example.com/contact\\\",\\n            \\\"email\\\": \\\"contact@example.com\\\"\\n        },\\n        \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"servers\\\": {\\n        \\\"mosquitto\\\": {\\n            \\\"url\\\": \\\"mqtt://test.mosquitto.org\\\",\\n            \\\"protocol\\\": \\\"mqtt\\\"\\n        }\\n    },\\n    \\\"channels\\\": {\\n        \\\"light/measured\\\": {\\n            \\\"publish\\\": {\\n                \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\",\\n                \\\"operationId\\\": \\\"onLightMeasured\\\",\\n                \\\"message\\\": {\\n                    \\\"name\\\": \\\"LightMeasured\\\",\\n                    \\\"payload\\\": {\\n                        \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayloadSchema\\\"\\n                    },\\n                    \\\"examples\\\": [\\n                        {\\n                            \\\"payload\\\": {\\n                                \\\"id\\\": 1,\\n                                \\\"lumens\\\": 1,\\n                                \\\"sentAt\\\": \\\"2023-09-01T18:00:00.000Z\\\"\\n                            }\\n                        }\\n                    ]\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"schemas\\\": {\\n            \\\"LightMeasuredPayloadSchema\\\": {\\n                \\\"type\\\": \\\"object\\\",\\n                \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n                \\\"required\\\": [\\n                    \\\"id\\\",\\n                    \\\"lumens\\\",\\n                    \\\"sentAt\\\"\\n                ],\\n                \\\"properties\\\": {\\n                    \\\"id\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Id of the streetlight\\\"\\n                    },\\n                    \\\"lumens\\\": {\\n                        \\\"type\\\": \\\"integer\\\",\\n                        \\\"minimum\\\": 0,\\n                        \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n                    },\\n                    \\\"sentAt\\\": {\\n                        \\\"type\\\": \\\"string\\\",\\n                        \\\"format\\\": \\\"date-time\\\",\\n                        \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n                        \\\"minLength\\\": 20,\\n                        \\\"maxLength\\\": 29\\n                    }\\n                }\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create AsyncAPI 2.0 JSON Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Streetlights API",
  "type": "ASYNCAPI:2.0",
  "files": [
    [
      "content": "{
    \"asyncapi\": \"2.5.0\",
    \"info\": {
        \"title\": \"Streetlights API\",
        \"version\": \"1.0.0\",
        \"description\": \"The Smartylighting Streetlights API allows you\nto remotely manage the city lights.\n\",
        \"license\": {
            \"name\": \"Apache 2.0\",
            \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"
        },
        \"contact\": {
            \"name\": \"Streetlights API Developers\",
            \"url\": \"https://example.com/contact\",
            \"email\": \"contact@example.com\"
        },
        \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"
    },
    \"servers\": {
        \"mosquitto\": {
            \"url\": \"mqtt://test.mosquitto.org\",
            \"protocol\": \"mqtt\"
        }
    },
    \"channels\": {
        \"light/measured\": {
            \"publish\": {
                \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\",
                \"operationId\": \"onLightMeasured\",
                \"message\": {
                    \"name\": \"LightMeasured\",
                    \"payload\": {
                        \"$ref\": \"#/components/schemas/LightMeasuredPayloadSchema\"
                    },
                    \"examples\": [
                        {
                            \"payload\": {
                                \"id\": 1,
                                \"lumens\": 1,
                                \"sentAt\": \"2023-09-01T18:00:00.000Z\"
                            }
                        }
                    ]
                }
            }
        }
    },
    \"components\": {
        \"schemas\": {
            \"LightMeasuredPayloadSchema\": {
                \"type\": \"object\",
                \"description\": \"Payload for LightMeasured API\",
                \"required\": [
                    \"id\",
                    \"lumens\",
                    \"sentAt\"
                ],
                \"properties\": {
                    \"id\": {
                        \"type\": \"integer\",
                        \"minimum\": 0,
                        \"description\": \"Id of the streetlight\"
                    },
                    \"lumens\": {
                        \"type\": \"integer\",
                        \"minimum\": 0,
                        \"description\": \"Light intensity measured in lumens\"
                    },
                    \"sentAt\": {
                        \"type\": \"string\",
                        \"format\": \"date-time\",
                        \"description\": \"Date and time when the message was sent\",
                        \"minLength\": 20,
                        \"maxLength\": 29
                    }
                }
            }
        }
    }
}",
      "path": "index.json",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create AsyncAPI 2.0 YAML Spec



**Request**

```json
{
  "name": "Streetlights API",
  "type": "ASYNCAPI:2.0",
  "files": [
    {
      "content": "asyncapi: '2.5.0'\ninfo:\n  title: Streetlights API\n  version: '1.0.0'\n  description: |\n    The Smartylighting Streetlights API allows you\n    to remotely manage the city lights.\n  license:\n    name: Apache 2.0\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\n  contact:\n    name: Streetlights API Developers\n    url: https://example.com/contact\n    email: contact@example.com\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\nservers:\n  mosquitto:\n    url: mqtt://test.mosquitto.org\n    protocol: mqtt\nchannels:\n  light/measured:\n    publish:\n      summary: Inform about environmental lighting conditions for a particular streetlight\n      operationId: onLightMeasured\n      message:\n        name: LightMeasured\n        payload:\n          $ref: '#/components/schemas/LightMeasuredPayloadSchema'\n        examples:\n          - payload:\n              id: 1\n              lumens: 1\n              sentAt: 2023-09-01T18:00:00Z\ncomponents:\n  schemas:\n    LightMeasuredPayloadSchema:\n      type: object\n      description: Payload for LightMeasured API\n      required:\n        - id\n        - lumens\n        - sentAt\n      properties:\n        id:\n          type: integer\n          minimum: 0\n          description: Id of the streetlight\n        lumens:\n          type: integer\n          minimum: 0\n          description: Light intensity measured in lumens\n        sentAt:\n          type: string\n          format: date-time\n          description: Date and time when the message was sent\n          minLength: 20\n          maxLength: 29",
      "path": "index.yaml",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create AsyncAPI 2.0 YAML Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Streetlights API",
    "type": "ASYNCAPI:2.0",
    "files": [
        {
            "content": "asyncapi: '2.5.0'
info:
  title: Streetlights API
  version: '1.0.0'
  description: |
    The Smartylighting Streetlights API allows you
    to remotely manage the city lights.
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'
  contact:
    name: Streetlights API Developers
    url: https://example.com/contact
    email: contact@example.com
  termsOfService: https://www.apache.org/licenses/LICENSE-2.0
servers:
  mosquitto:
    url: mqtt://test.mosquitto.org
    protocol: mqtt
channels:
  light/measured:
    publish:
      summary: Inform about environmental lighting conditions for a particular streetlight
      operationId: onLightMeasured
      message:
        name: LightMeasured
        payload:
          $ref: '#/components/schemas/LightMeasuredPayloadSchema'
        examples:
          - payload:
              id: 1
              lumens: 1
              sentAt: 2023-09-01T18:00:00Z
components:
  schemas:
    LightMeasuredPayloadSchema:
      type: object
      description: Payload for LightMeasured API
      required:
        - id
        - lumens
        - sentAt
      properties:
        id:
          type: integer
          minimum: 0
          description: Id of the streetlight
        lumens:
          type: integer
          minimum: 0
          description: Light intensity measured in lumens
        sentAt:
          type: string
          format: date-time
          description: Date and time when the message was sent
          minLength: 20
          maxLength: 29",
            "path": "index.yaml",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create AsyncAPI 2.0 YAML Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Streetlights API","type":"ASYNCAPI:2.0","files":[{"content":"asyncapi: \'2.5.0\'\ninfo:\n  title: Streetlights API\n  version: \'1.0.0\'\n  description: |\n    The Smartylighting Streetlights API allows you\n    to remotely manage the city lights.\n  license:\n    name: Apache 2.0\n    url: \'https://www.apache.org/licenses/LICENSE-2.0\'\n  contact:\n    name: Streetlights API Developers\n    url: https://example.com/contact\n    email: contact@example.com\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\nservers:\n  mosquitto:\n    url: mqtt://test.mosquitto.org\n    protocol: mqtt\nchannels:\n  light/measured:\n    publish:\n      summary: Inform about environmental lighting conditions for a particular streetlight\n      operationId: onLightMeasured\n      message:\n        name: LightMeasured\n        payload:\n          $ref: \'#/components/schemas/LightMeasuredPayloadSchema\'\n        examples:\n          - payload:\n              id: 1\n              lumens: 1\n              sentAt: 2023-09-01T18:00:00Z\ncomponents:\n  schemas:\n    LightMeasuredPayloadSchema:\n      type: object\n      description: Payload for LightMeasured API\n      required:\n        - id\n        - lumens\n        - sentAt\n      properties:\n        id:\n          type: integer\n          minimum: 0\n          description: Id of the streetlight\n        lumens:\n          type: integer\n          minimum: 0\n          description: Light intensity measured in lumens\n        sentAt:\n          type: string\n          format: date-time\n          description: Date and time when the message was sent\n          minLength: 20\n          maxLength: 29","path":"index.yaml","type":"DEFAULT"}]}'
};

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

```go Create AsyncAPI 2.0 YAML Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '2.5.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    url: mqtt://test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  light/measured:\\n    publish:\\n      summary: Inform about environmental lighting conditions for a particular streetlight\\n      operationId: onLightMeasured\\n      message:\\n        name: LightMeasured\\n        payload:\\n          $ref: '#/components/schemas/LightMeasuredPayloadSchema'\\n        examples:\\n          - payload:\\n              id: 1\\n              lumens: 1\\n              sentAt: 2023-09-01T18:00:00Z\\ncomponents:\\n  schemas:\\n    LightMeasuredPayloadSchema:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\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 Create AsyncAPI 2.0 YAML Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '2.5.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    url: mqtt://test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  light/measured:\\n    publish:\\n      summary: Inform about environmental lighting conditions for a particular streetlight\\n      operationId: onLightMeasured\\n      message:\\n        name: LightMeasured\\n        payload:\\n          $ref: '#/components/schemas/LightMeasuredPayloadSchema'\\n        examples:\\n          - payload:\\n              id: 1\\n              lumens: 1\\n              sentAt: 2023-09-01T18:00:00Z\\ncomponents:\\n  schemas:\\n    LightMeasuredPayloadSchema:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create AsyncAPI 2.0 YAML Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '2.5.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    url: mqtt://test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  light/measured:\\n    publish:\\n      summary: Inform about environmental lighting conditions for a particular streetlight\\n      operationId: onLightMeasured\\n      message:\\n        name: LightMeasured\\n        payload:\\n          $ref: '#/components/schemas/LightMeasuredPayloadSchema'\\n        examples:\\n          - payload:\\n              id: 1\\n              lumens: 1\\n              sentAt: 2023-09-01T18:00:00Z\\ncomponents:\\n  schemas:\\n    LightMeasuredPayloadSchema:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create AsyncAPI 2.0 YAML Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Streetlights API",
  "type": "ASYNCAPI:2.0",
  "files": [
    {
      "content": "asyncapi: \'2.5.0\'\\ninfo:\\n  title: Streetlights API\\n  version: \'1.0.0\'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: \'https://www.apache.org/licenses/LICENSE-2.0\'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    url: mqtt://test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  light/measured:\\n    publish:\\n      summary: Inform about environmental lighting conditions for a particular streetlight\\n      operationId: onLightMeasured\\n      message:\\n        name: LightMeasured\\n        payload:\\n          $ref: \'#/components/schemas/LightMeasuredPayloadSchema\'\\n        examples:\\n          - payload:\\n              id: 1\\n              lumens: 1\\n              sentAt: 2023-09-01T18:00:00Z\\ncomponents:\\n  schemas:\\n    LightMeasuredPayloadSchema:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29",
      "path": "index.yaml",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create AsyncAPI 2.0 YAML Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:2.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '2.5.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    url: mqtt://test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  light/measured:\\n    publish:\\n      summary: Inform about environmental lighting conditions for a particular streetlight\\n      operationId: onLightMeasured\\n      message:\\n        name: LightMeasured\\n        payload:\\n          $ref: '#/components/schemas/LightMeasuredPayloadSchema'\\n        examples:\\n          - payload:\\n              id: 1\\n              lumens: 1\\n              sentAt: 2023-09-01T18:00:00Z\\ncomponents:\\n  schemas:\\n    LightMeasuredPayloadSchema:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create AsyncAPI 2.0 YAML Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Streetlights API",
  "type": "ASYNCAPI:2.0",
  "files": [
    [
      "content": "asyncapi: '2.5.0'
info:
  title: Streetlights API
  version: '1.0.0'
  description: |
    The Smartylighting Streetlights API allows you
    to remotely manage the city lights.
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'
  contact:
    name: Streetlights API Developers
    url: https://example.com/contact
    email: contact@example.com
  termsOfService: https://www.apache.org/licenses/LICENSE-2.0
servers:
  mosquitto:
    url: mqtt://test.mosquitto.org
    protocol: mqtt
channels:
  light/measured:
    publish:
      summary: Inform about environmental lighting conditions for a particular streetlight
      operationId: onLightMeasured
      message:
        name: LightMeasured
        payload:
          $ref: '#/components/schemas/LightMeasuredPayloadSchema'
        examples:
          - payload:
              id: 1
              lumens: 1
              sentAt: 2023-09-01T18:00:00Z
components:
  schemas:
    LightMeasuredPayloadSchema:
      type: object
      description: Payload for LightMeasured API
      required:
        - id
        - lumens
        - sentAt
      properties:
        id:
          type: integer
          minimum: 0
          description: Id of the streetlight
        lumens:
          type: integer
          minimum: 0
          description: Light intensity measured in lumens
        sentAt:
          type: string
          format: date-time
          description: Date and time when the message was sent
          minLength: 20
          maxLength: 29",
      "path": "index.yaml",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create AsyncAPI 3.0 JSON Spec



**Request**

```json
{
  "name": "Streetlights API",
  "type": "ASYNCAPI:3.0",
  "files": [
    {
      "content": "{\n  \"asyncapi\": \"3.0.0\",\n  \"info\": {\n    \"title\": \"Streetlights API\",\n    \"version\": \"1.0.0\",\n    \"description\": \"The Smartylighting Streetlights API allows you\\nto remotely manage the city lights.\\n\",\n    \"license\": {\n      \"name\": \"Apache 2.0\",\n      \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n    },\n    \"contact\": {\n      \"name\": \"Streetlights API Developers\",\n      \"url\": \"https://example.com/contact\",\n      \"email\": \"contact@example.com\"\n    },\n    \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n  },\n  \"servers\": {\n    \"mosquitto\": {\n      \"host\": \"test.mosquitto.org\",\n      \"protocol\": \"mqtt\"\n    }\n  },\n  \"channels\": {\n    \"lightMeasured\": {\n      \"address\": \"light/measured\",\n      \"messages\": {\n        \"lightMeasured\": {\n          \"$ref\": \"#/components/messages/LightMeasured\"\n        }\n      }\n    }\n  },\n  \"operations\": {\n    \"onLightMeasured\": {\n      \"action\": \"receive\",\n      \"channel\": {\n        \"$ref\": \"#/channels/lightMeasured\"\n      },\n      \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\"\n    }\n  },\n  \"components\": {\n    \"messages\": {\n      \"LightMeasured\": {\n        \"name\": \"LightMeasured\",\n        \"payload\": {\n          \"$ref\": \"#/components/schemas/LightMeasuredPayload\"\n        }\n      }\n    },\n    \"schemas\": {\n      \"LightMeasuredPayload\": {\n        \"type\": \"object\",\n        \"description\": \"Payload for LightMeasured API\",\n        \"required\": [\n          \"id\",\n          \"lumens\",\n          \"sentAt\"\n        ],\n        \"properties\": {\n          \"id\": {\n            \"type\": \"integer\",\n            \"minimum\": 0,\n            \"description\": \"Id of the streetlight\"\n          },\n          \"lumens\": {\n            \"type\": \"integer\",\n            \"minimum\": 0,\n            \"description\": \"Light intensity measured in lumens\"\n          },\n          \"sentAt\": {\n            \"type\": \"string\",\n            \"format\": \"date-time\",\n            \"description\": \"Date and time when the message was sent\",\n            \"minLength\": 20,\n            \"maxLength\": 29\n          }\n        }\n      }\n    }\n  }\n}",
      "path": "index.json",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create AsyncAPI 3.0 JSON Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Streetlights API",
    "type": "ASYNCAPI:3.0",
    "files": [
        {
            "content": "{
  \"asyncapi\": \"3.0.0\",
  \"info\": {
    \"title\": \"Streetlights API\",
    \"version\": \"1.0.0\",
    \"description\": \"The Smartylighting Streetlights API allows you\nto remotely manage the city lights.\n\",
    \"license\": {
      \"name\": \"Apache 2.0\",
      \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"
    },
    \"contact\": {
      \"name\": \"Streetlights API Developers\",
      \"url\": \"https://example.com/contact\",
      \"email\": \"contact@example.com\"
    },
    \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"
  },
  \"servers\": {
    \"mosquitto\": {
      \"host\": \"test.mosquitto.org\",
      \"protocol\": \"mqtt\"
    }
  },
  \"channels\": {
    \"lightMeasured\": {
      \"address\": \"light/measured\",
      \"messages\": {
        \"lightMeasured\": {
          \"$ref\": \"#/components/messages/LightMeasured\"
        }
      }
    }
  },
  \"operations\": {
    \"onLightMeasured\": {
      \"action\": \"receive\",
      \"channel\": {
        \"$ref\": \"#/channels/lightMeasured\"
      },
      \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\"
    }
  },
  \"components\": {
    \"messages\": {
      \"LightMeasured\": {
        \"name\": \"LightMeasured\",
        \"payload\": {
          \"$ref\": \"#/components/schemas/LightMeasuredPayload\"
        }
      }
    },
    \"schemas\": {
      \"LightMeasuredPayload\": {
        \"type\": \"object\",
        \"description\": \"Payload for LightMeasured API\",
        \"required\": [
          \"id\",
          \"lumens\",
          \"sentAt\"
        ],
        \"properties\": {
          \"id\": {
            \"type\": \"integer\",
            \"minimum\": 0,
            \"description\": \"Id of the streetlight\"
          },
          \"lumens\": {
            \"type\": \"integer\",
            \"minimum\": 0,
            \"description\": \"Light intensity measured in lumens\"
          },
          \"sentAt\": {
            \"type\": \"string\",
            \"format\": \"date-time\",
            \"description\": \"Date and time when the message was sent\",
            \"minLength\": 20,
            \"maxLength\": 29
          }
        }
      }
    }
  }
}",
            "path": "index.json",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create AsyncAPI 3.0 JSON Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Streetlights API","type":"ASYNCAPI:3.0","files":[{"content":"{\n  \"asyncapi\": \"3.0.0\",\n  \"info\": {\n    \"title\": \"Streetlights API\",\n    \"version\": \"1.0.0\",\n    \"description\": \"The Smartylighting Streetlights API allows you\\nto remotely manage the city lights.\\n\",\n    \"license\": {\n      \"name\": \"Apache 2.0\",\n      \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n    },\n    \"contact\": {\n      \"name\": \"Streetlights API Developers\",\n      \"url\": \"https://example.com/contact\",\n      \"email\": \"contact@example.com\"\n    },\n    \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"\n  },\n  \"servers\": {\n    \"mosquitto\": {\n      \"host\": \"test.mosquitto.org\",\n      \"protocol\": \"mqtt\"\n    }\n  },\n  \"channels\": {\n    \"lightMeasured\": {\n      \"address\": \"light/measured\",\n      \"messages\": {\n        \"lightMeasured\": {\n          \"$ref\": \"#/components/messages/LightMeasured\"\n        }\n      }\n    }\n  },\n  \"operations\": {\n    \"onLightMeasured\": {\n      \"action\": \"receive\",\n      \"channel\": {\n        \"$ref\": \"#/channels/lightMeasured\"\n      },\n      \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\"\n    }\n  },\n  \"components\": {\n    \"messages\": {\n      \"LightMeasured\": {\n        \"name\": \"LightMeasured\",\n        \"payload\": {\n          \"$ref\": \"#/components/schemas/LightMeasuredPayload\"\n        }\n      }\n    },\n    \"schemas\": {\n      \"LightMeasuredPayload\": {\n        \"type\": \"object\",\n        \"description\": \"Payload for LightMeasured API\",\n        \"required\": [\n          \"id\",\n          \"lumens\",\n          \"sentAt\"\n        ],\n        \"properties\": {\n          \"id\": {\n            \"type\": \"integer\",\n            \"minimum\": 0,\n            \"description\": \"Id of the streetlight\"\n          },\n          \"lumens\": {\n            \"type\": \"integer\",\n            \"minimum\": 0,\n            \"description\": \"Light intensity measured in lumens\"\n          },\n          \"sentAt\": {\n            \"type\": \"string\",\n            \"format\": \"date-time\",\n            \"description\": \"Date and time when the message was sent\",\n            \"minLength\": 20,\n            \"maxLength\": 29\n          }\n        }\n      }\n    }\n  }\n}","path":"index.json","type":"DEFAULT"}]}'
};

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

```go Create AsyncAPI 3.0 JSON Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"asyncapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"title\\\": \\\"Streetlights API\\\",\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n    \\\"license\\\": {\\n      \\\"name\\\": \\\"Apache 2.0\\\",\\n      \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"contact\\\": {\\n      \\\"name\\\": \\\"Streetlights API Developers\\\",\\n      \\\"url\\\": \\\"https://example.com/contact\\\",\\n      \\\"email\\\": \\\"contact@example.com\\\"\\n    },\\n    \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n  },\\n  \\\"servers\\\": {\\n    \\\"mosquitto\\\": {\\n      \\\"host\\\": \\\"test.mosquitto.org\\\",\\n      \\\"protocol\\\": \\\"mqtt\\\"\\n    }\\n  },\\n  \\\"channels\\\": {\\n    \\\"lightMeasured\\\": {\\n      \\\"address\\\": \\\"light/measured\\\",\\n      \\\"messages\\\": {\\n        \\\"lightMeasured\\\": {\\n          \\\"$ref\\\": \\\"#/components/messages/LightMeasured\\\"\\n        }\\n      }\\n    }\\n  },\\n  \\\"operations\\\": {\\n    \\\"onLightMeasured\\\": {\\n      \\\"action\\\": \\\"receive\\\",\\n      \\\"channel\\\": {\\n        \\\"$ref\\\": \\\"#/channels/lightMeasured\\\"\\n      },\\n      \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\"\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"messages\\\": {\\n      \\\"LightMeasured\\\": {\\n        \\\"name\\\": \\\"LightMeasured\\\",\\n        \\\"payload\\\": {\\n          \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayload\\\"\\n        }\\n      }\\n    },\\n    \\\"schemas\\\": {\\n      \\\"LightMeasuredPayload\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"lumens\\\",\\n          \\\"sentAt\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Id of the streetlight\\\"\\n          },\\n          \\\"lumens\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n          },\\n          \\\"sentAt\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"format\\\": \\\"date-time\\\",\\n            \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n            \\\"minLength\\\": 20,\\n            \\\"maxLength\\\": 29\\n          }\\n        }\\n      }\\n    }\\n  }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\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 Create AsyncAPI 3.0 JSON Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"asyncapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"title\\\": \\\"Streetlights API\\\",\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n    \\\"license\\\": {\\n      \\\"name\\\": \\\"Apache 2.0\\\",\\n      \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"contact\\\": {\\n      \\\"name\\\": \\\"Streetlights API Developers\\\",\\n      \\\"url\\\": \\\"https://example.com/contact\\\",\\n      \\\"email\\\": \\\"contact@example.com\\\"\\n    },\\n    \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n  },\\n  \\\"servers\\\": {\\n    \\\"mosquitto\\\": {\\n      \\\"host\\\": \\\"test.mosquitto.org\\\",\\n      \\\"protocol\\\": \\\"mqtt\\\"\\n    }\\n  },\\n  \\\"channels\\\": {\\n    \\\"lightMeasured\\\": {\\n      \\\"address\\\": \\\"light/measured\\\",\\n      \\\"messages\\\": {\\n        \\\"lightMeasured\\\": {\\n          \\\"$ref\\\": \\\"#/components/messages/LightMeasured\\\"\\n        }\\n      }\\n    }\\n  },\\n  \\\"operations\\\": {\\n    \\\"onLightMeasured\\\": {\\n      \\\"action\\\": \\\"receive\\\",\\n      \\\"channel\\\": {\\n        \\\"$ref\\\": \\\"#/channels/lightMeasured\\\"\\n      },\\n      \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\"\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"messages\\\": {\\n      \\\"LightMeasured\\\": {\\n        \\\"name\\\": \\\"LightMeasured\\\",\\n        \\\"payload\\\": {\\n          \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayload\\\"\\n        }\\n      }\\n    },\\n    \\\"schemas\\\": {\\n      \\\"LightMeasuredPayload\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"lumens\\\",\\n          \\\"sentAt\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Id of the streetlight\\\"\\n          },\\n          \\\"lumens\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n          },\\n          \\\"sentAt\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"format\\\": \\\"date-time\\\",\\n            \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n            \\\"minLength\\\": 20,\\n            \\\"maxLength\\\": 29\\n          }\\n        }\\n      }\\n    }\\n  }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create AsyncAPI 3.0 JSON Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"asyncapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"title\\\": \\\"Streetlights API\\\",\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n    \\\"license\\\": {\\n      \\\"name\\\": \\\"Apache 2.0\\\",\\n      \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"contact\\\": {\\n      \\\"name\\\": \\\"Streetlights API Developers\\\",\\n      \\\"url\\\": \\\"https://example.com/contact\\\",\\n      \\\"email\\\": \\\"contact@example.com\\\"\\n    },\\n    \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n  },\\n  \\\"servers\\\": {\\n    \\\"mosquitto\\\": {\\n      \\\"host\\\": \\\"test.mosquitto.org\\\",\\n      \\\"protocol\\\": \\\"mqtt\\\"\\n    }\\n  },\\n  \\\"channels\\\": {\\n    \\\"lightMeasured\\\": {\\n      \\\"address\\\": \\\"light/measured\\\",\\n      \\\"messages\\\": {\\n        \\\"lightMeasured\\\": {\\n          \\\"$ref\\\": \\\"#/components/messages/LightMeasured\\\"\\n        }\\n      }\\n    }\\n  },\\n  \\\"operations\\\": {\\n    \\\"onLightMeasured\\\": {\\n      \\\"action\\\": \\\"receive\\\",\\n      \\\"channel\\\": {\\n        \\\"$ref\\\": \\\"#/channels/lightMeasured\\\"\\n      },\\n      \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\"\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"messages\\\": {\\n      \\\"LightMeasured\\\": {\\n        \\\"name\\\": \\\"LightMeasured\\\",\\n        \\\"payload\\\": {\\n          \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayload\\\"\\n        }\\n      }\\n    },\\n    \\\"schemas\\\": {\\n      \\\"LightMeasuredPayload\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"lumens\\\",\\n          \\\"sentAt\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Id of the streetlight\\\"\\n          },\\n          \\\"lumens\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n          },\\n          \\\"sentAt\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"format\\\": \\\"date-time\\\",\\n            \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n            \\\"minLength\\\": 20,\\n            \\\"maxLength\\\": 29\\n          }\\n        }\\n      }\\n    }\\n  }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create AsyncAPI 3.0 JSON Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Streetlights API",
  "type": "ASYNCAPI:3.0",
  "files": [
    {
      "content": "{\\n  \\"asyncapi\\": \\"3.0.0\\",\\n  \\"info\\": {\\n    \\"title\\": \\"Streetlights API\\",\\n    \\"version\\": \\"1.0.0\\",\\n    \\"description\\": \\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\",\\n    \\"license\\": {\\n      \\"name\\": \\"Apache 2.0\\",\\n      \\"url\\": \\"https://www.apache.org/licenses/LICENSE-2.0\\"\\n    },\\n    \\"contact\\": {\\n      \\"name\\": \\"Streetlights API Developers\\",\\n      \\"url\\": \\"https://example.com/contact\\",\\n      \\"email\\": \\"contact@example.com\\"\\n    },\\n    \\"termsOfService\\": \\"https://www.apache.org/licenses/LICENSE-2.0\\"\\n  },\\n  \\"servers\\": {\\n    \\"mosquitto\\": {\\n      \\"host\\": \\"test.mosquitto.org\\",\\n      \\"protocol\\": \\"mqtt\\"\\n    }\\n  },\\n  \\"channels\\": {\\n    \\"lightMeasured\\": {\\n      \\"address\\": \\"light/measured\\",\\n      \\"messages\\": {\\n        \\"lightMeasured\\": {\\n          \\"$ref\\": \\"#/components/messages/LightMeasured\\"\\n        }\\n      }\\n    }\\n  },\\n  \\"operations\\": {\\n    \\"onLightMeasured\\": {\\n      \\"action\\": \\"receive\\",\\n      \\"channel\\": {\\n        \\"$ref\\": \\"#/channels/lightMeasured\\"\\n      },\\n      \\"summary\\": \\"Inform about environmental lighting conditions for a particular streetlight\\"\\n    }\\n  },\\n  \\"components\\": {\\n    \\"messages\\": {\\n      \\"LightMeasured\\": {\\n        \\"name\\": \\"LightMeasured\\",\\n        \\"payload\\": {\\n          \\"$ref\\": \\"#/components/schemas/LightMeasuredPayload\\"\\n        }\\n      }\\n    },\\n    \\"schemas\\": {\\n      \\"LightMeasuredPayload\\": {\\n        \\"type\\": \\"object\\",\\n        \\"description\\": \\"Payload for LightMeasured API\\",\\n        \\"required\\": [\\n          \\"id\\",\\n          \\"lumens\\",\\n          \\"sentAt\\"\\n        ],\\n        \\"properties\\": {\\n          \\"id\\": {\\n            \\"type\\": \\"integer\\",\\n            \\"minimum\\": 0,\\n            \\"description\\": \\"Id of the streetlight\\"\\n          },\\n          \\"lumens\\": {\\n            \\"type\\": \\"integer\\",\\n            \\"minimum\\": 0,\\n            \\"description\\": \\"Light intensity measured in lumens\\"\\n          },\\n          \\"sentAt\\": {\\n            \\"type\\": \\"string\\",\\n            \\"format\\": \\"date-time\\",\\n            \\"description\\": \\"Date and time when the message was sent\\",\\n            \\"minLength\\": 20,\\n            \\"maxLength\\": 29\\n          }\\n        }\\n      }\\n    }\\n  }\\n}",
      "path": "index.json",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create AsyncAPI 3.0 JSON Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n  \\\"asyncapi\\\": \\\"3.0.0\\\",\\n  \\\"info\\\": {\\n    \\\"title\\\": \\\"Streetlights API\\\",\\n    \\\"version\\\": \\\"1.0.0\\\",\\n    \\\"description\\\": \\\"The Smartylighting Streetlights API allows you\\\\nto remotely manage the city lights.\\\\n\\\",\\n    \\\"license\\\": {\\n      \\\"name\\\": \\\"Apache 2.0\\\",\\n      \\\"url\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n    },\\n    \\\"contact\\\": {\\n      \\\"name\\\": \\\"Streetlights API Developers\\\",\\n      \\\"url\\\": \\\"https://example.com/contact\\\",\\n      \\\"email\\\": \\\"contact@example.com\\\"\\n    },\\n    \\\"termsOfService\\\": \\\"https://www.apache.org/licenses/LICENSE-2.0\\\"\\n  },\\n  \\\"servers\\\": {\\n    \\\"mosquitto\\\": {\\n      \\\"host\\\": \\\"test.mosquitto.org\\\",\\n      \\\"protocol\\\": \\\"mqtt\\\"\\n    }\\n  },\\n  \\\"channels\\\": {\\n    \\\"lightMeasured\\\": {\\n      \\\"address\\\": \\\"light/measured\\\",\\n      \\\"messages\\\": {\\n        \\\"lightMeasured\\\": {\\n          \\\"$ref\\\": \\\"#/components/messages/LightMeasured\\\"\\n        }\\n      }\\n    }\\n  },\\n  \\\"operations\\\": {\\n    \\\"onLightMeasured\\\": {\\n      \\\"action\\\": \\\"receive\\\",\\n      \\\"channel\\\": {\\n        \\\"$ref\\\": \\\"#/channels/lightMeasured\\\"\\n      },\\n      \\\"summary\\\": \\\"Inform about environmental lighting conditions for a particular streetlight\\\"\\n    }\\n  },\\n  \\\"components\\\": {\\n    \\\"messages\\\": {\\n      \\\"LightMeasured\\\": {\\n        \\\"name\\\": \\\"LightMeasured\\\",\\n        \\\"payload\\\": {\\n          \\\"$ref\\\": \\\"#/components/schemas/LightMeasuredPayload\\\"\\n        }\\n      }\\n    },\\n    \\\"schemas\\\": {\\n      \\\"LightMeasuredPayload\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"description\\\": \\\"Payload for LightMeasured API\\\",\\n        \\\"required\\\": [\\n          \\\"id\\\",\\n          \\\"lumens\\\",\\n          \\\"sentAt\\\"\\n        ],\\n        \\\"properties\\\": {\\n          \\\"id\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Id of the streetlight\\\"\\n          },\\n          \\\"lumens\\\": {\\n            \\\"type\\\": \\\"integer\\\",\\n            \\\"minimum\\\": 0,\\n            \\\"description\\\": \\\"Light intensity measured in lumens\\\"\\n          },\\n          \\\"sentAt\\\": {\\n            \\\"type\\\": \\\"string\\\",\\n            \\\"format\\\": \\\"date-time\\\",\\n            \\\"description\\\": \\\"Date and time when the message was sent\\\",\\n            \\\"minLength\\\": 20,\\n            \\\"maxLength\\\": 29\\n          }\\n        }\\n      }\\n    }\\n  }\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create AsyncAPI 3.0 JSON Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Streetlights API",
  "type": "ASYNCAPI:3.0",
  "files": [
    [
      "content": "{
  \"asyncapi\": \"3.0.0\",
  \"info\": {
    \"title\": \"Streetlights API\",
    \"version\": \"1.0.0\",
    \"description\": \"The Smartylighting Streetlights API allows you\nto remotely manage the city lights.\n\",
    \"license\": {
      \"name\": \"Apache 2.0\",
      \"url\": \"https://www.apache.org/licenses/LICENSE-2.0\"
    },
    \"contact\": {
      \"name\": \"Streetlights API Developers\",
      \"url\": \"https://example.com/contact\",
      \"email\": \"contact@example.com\"
    },
    \"termsOfService\": \"https://www.apache.org/licenses/LICENSE-2.0\"
  },
  \"servers\": {
    \"mosquitto\": {
      \"host\": \"test.mosquitto.org\",
      \"protocol\": \"mqtt\"
    }
  },
  \"channels\": {
    \"lightMeasured\": {
      \"address\": \"light/measured\",
      \"messages\": {
        \"lightMeasured\": {
          \"$ref\": \"#/components/messages/LightMeasured\"
        }
      }
    }
  },
  \"operations\": {
    \"onLightMeasured\": {
      \"action\": \"receive\",
      \"channel\": {
        \"$ref\": \"#/channels/lightMeasured\"
      },
      \"summary\": \"Inform about environmental lighting conditions for a particular streetlight\"
    }
  },
  \"components\": {
    \"messages\": {
      \"LightMeasured\": {
        \"name\": \"LightMeasured\",
        \"payload\": {
          \"$ref\": \"#/components/schemas/LightMeasuredPayload\"
        }
      }
    },
    \"schemas\": {
      \"LightMeasuredPayload\": {
        \"type\": \"object\",
        \"description\": \"Payload for LightMeasured API\",
        \"required\": [
          \"id\",
          \"lumens\",
          \"sentAt\"
        ],
        \"properties\": {
          \"id\": {
            \"type\": \"integer\",
            \"minimum\": 0,
            \"description\": \"Id of the streetlight\"
          },
          \"lumens\": {
            \"type\": \"integer\",
            \"minimum\": 0,
            \"description\": \"Light intensity measured in lumens\"
          },
          \"sentAt\": {
            \"type\": \"string\",
            \"format\": \"date-time\",
            \"description\": \"Date and time when the message was sent\",
            \"minLength\": 20,
            \"maxLength\": 29
          }
        }
      }
    }
  }
}",
      "path": "index.json",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create AsyncAPI 3.0 YAML Spec



**Request**

```json
{
  "name": "Streetlights API",
  "type": "ASYNCAPI:3.0",
  "files": [
    {
      "content": "asyncapi: '3.0.0'\ninfo:\n  title: Streetlights API\n  version: '1.0.0'\n  description: |\n    The Smartylighting Streetlights API allows you\n    to remotely manage the city lights.\n  license:\n    name: Apache 2.0\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\n  contact:\n    name: Streetlights API Developers\n    url: https://example.com/contact\n    email: contact@example.com\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\nservers:\n  mosquitto:\n    host: test.mosquitto.org\n    protocol: mqtt\nchannels:\n  lightMeasured:\n    address: light/measured\n    messages:\n      lightMeasured:\n        $ref: '#/components/messages/LightMeasured'\noperations:\n  onLightMeasured:\n    action: receive\n    channel:\n      $ref: '#/channels/lightMeasured'\n    summary: Inform about environmental lighting conditions for a particular streetlight\ncomponents:\n  messages:\n    LightMeasured:\n      name: LightMeasured\n      payload:\n        $ref: '#/components/schemas/LightMeasuredPayload'\n  schemas:\n    LightMeasuredPayload:\n      type: object\n      description: Payload for LightMeasured API\n      required:\n        - id\n        - lumens\n        - sentAt\n      properties:\n        id:\n          type: integer\n          minimum: 0\n          description: Id of the streetlight\n        lumens:\n          type: integer\n          minimum: 0\n          description: Light intensity measured in lumens\n        sentAt:\n          type: string\n          format: date-time\n          description: Date and time when the message was sent\n          minLength: 20\n          maxLength: 29",
      "path": "index.yaml",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create AsyncAPI 3.0 YAML Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Streetlights API",
    "type": "ASYNCAPI:3.0",
    "files": [
        {
            "content": "asyncapi: '3.0.0'
info:
  title: Streetlights API
  version: '1.0.0'
  description: |
    The Smartylighting Streetlights API allows you
    to remotely manage the city lights.
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'
  contact:
    name: Streetlights API Developers
    url: https://example.com/contact
    email: contact@example.com
  termsOfService: https://www.apache.org/licenses/LICENSE-2.0
servers:
  mosquitto:
    host: test.mosquitto.org
    protocol: mqtt
channels:
  lightMeasured:
    address: light/measured
    messages:
      lightMeasured:
        $ref: '#/components/messages/LightMeasured'
operations:
  onLightMeasured:
    action: receive
    channel:
      $ref: '#/channels/lightMeasured'
    summary: Inform about environmental lighting conditions for a particular streetlight
components:
  messages:
    LightMeasured:
      name: LightMeasured
      payload:
        $ref: '#/components/schemas/LightMeasuredPayload'
  schemas:
    LightMeasuredPayload:
      type: object
      description: Payload for LightMeasured API
      required:
        - id
        - lumens
        - sentAt
      properties:
        id:
          type: integer
          minimum: 0
          description: Id of the streetlight
        lumens:
          type: integer
          minimum: 0
          description: Light intensity measured in lumens
        sentAt:
          type: string
          format: date-time
          description: Date and time when the message was sent
          minLength: 20
          maxLength: 29",
            "path": "index.yaml",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create AsyncAPI 3.0 YAML Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Streetlights API","type":"ASYNCAPI:3.0","files":[{"content":"asyncapi: \'3.0.0\'\ninfo:\n  title: Streetlights API\n  version: \'1.0.0\'\n  description: |\n    The Smartylighting Streetlights API allows you\n    to remotely manage the city lights.\n  license:\n    name: Apache 2.0\n    url: \'https://www.apache.org/licenses/LICENSE-2.0\'\n  contact:\n    name: Streetlights API Developers\n    url: https://example.com/contact\n    email: contact@example.com\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\nservers:\n  mosquitto:\n    host: test.mosquitto.org\n    protocol: mqtt\nchannels:\n  lightMeasured:\n    address: light/measured\n    messages:\n      lightMeasured:\n        $ref: \'#/components/messages/LightMeasured\'\noperations:\n  onLightMeasured:\n    action: receive\n    channel:\n      $ref: \'#/channels/lightMeasured\'\n    summary: Inform about environmental lighting conditions for a particular streetlight\ncomponents:\n  messages:\n    LightMeasured:\n      name: LightMeasured\n      payload:\n        $ref: \'#/components/schemas/LightMeasuredPayload\'\n  schemas:\n    LightMeasuredPayload:\n      type: object\n      description: Payload for LightMeasured API\n      required:\n        - id\n        - lumens\n        - sentAt\n      properties:\n        id:\n          type: integer\n          minimum: 0\n          description: Id of the streetlight\n        lumens:\n          type: integer\n          minimum: 0\n          description: Light intensity measured in lumens\n        sentAt:\n          type: string\n          format: date-time\n          description: Date and time when the message was sent\n          minLength: 20\n          maxLength: 29","path":"index.yaml","type":"DEFAULT"}]}'
};

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

```go Create AsyncAPI 3.0 YAML Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '3.0.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    host: test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  lightMeasured:\\n    address: light/measured\\n    messages:\\n      lightMeasured:\\n        $ref: '#/components/messages/LightMeasured'\\noperations:\\n  onLightMeasured:\\n    action: receive\\n    channel:\\n      $ref: '#/channels/lightMeasured'\\n    summary: Inform about environmental lighting conditions for a particular streetlight\\ncomponents:\\n  messages:\\n    LightMeasured:\\n      name: LightMeasured\\n      payload:\\n        $ref: '#/components/schemas/LightMeasuredPayload'\\n  schemas:\\n    LightMeasuredPayload:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\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 Create AsyncAPI 3.0 YAML Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '3.0.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    host: test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  lightMeasured:\\n    address: light/measured\\n    messages:\\n      lightMeasured:\\n        $ref: '#/components/messages/LightMeasured'\\noperations:\\n  onLightMeasured:\\n    action: receive\\n    channel:\\n      $ref: '#/channels/lightMeasured'\\n    summary: Inform about environmental lighting conditions for a particular streetlight\\ncomponents:\\n  messages:\\n    LightMeasured:\\n      name: LightMeasured\\n      payload:\\n        $ref: '#/components/schemas/LightMeasuredPayload'\\n  schemas:\\n    LightMeasuredPayload:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create AsyncAPI 3.0 YAML Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '3.0.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    host: test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  lightMeasured:\\n    address: light/measured\\n    messages:\\n      lightMeasured:\\n        $ref: '#/components/messages/LightMeasured'\\noperations:\\n  onLightMeasured:\\n    action: receive\\n    channel:\\n      $ref: '#/channels/lightMeasured'\\n    summary: Inform about environmental lighting conditions for a particular streetlight\\ncomponents:\\n  messages:\\n    LightMeasured:\\n      name: LightMeasured\\n      payload:\\n        $ref: '#/components/schemas/LightMeasuredPayload'\\n  schemas:\\n    LightMeasuredPayload:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create AsyncAPI 3.0 YAML Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Streetlights API",
  "type": "ASYNCAPI:3.0",
  "files": [
    {
      "content": "asyncapi: \'3.0.0\'\\ninfo:\\n  title: Streetlights API\\n  version: \'1.0.0\'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: \'https://www.apache.org/licenses/LICENSE-2.0\'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    host: test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  lightMeasured:\\n    address: light/measured\\n    messages:\\n      lightMeasured:\\n        $ref: \'#/components/messages/LightMeasured\'\\noperations:\\n  onLightMeasured:\\n    action: receive\\n    channel:\\n      $ref: \'#/channels/lightMeasured\'\\n    summary: Inform about environmental lighting conditions for a particular streetlight\\ncomponents:\\n  messages:\\n    LightMeasured:\\n      name: LightMeasured\\n      payload:\\n        $ref: \'#/components/schemas/LightMeasuredPayload\'\\n  schemas:\\n    LightMeasuredPayload:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29",
      "path": "index.yaml",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create AsyncAPI 3.0 YAML Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Streetlights API\",\n  \"type\": \"ASYNCAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"asyncapi: '3.0.0'\\ninfo:\\n  title: Streetlights API\\n  version: '1.0.0'\\n  description: |\\n    The Smartylighting Streetlights API allows you\\n    to remotely manage the city lights.\\n  license:\\n    name: Apache 2.0\\n    url: 'https://www.apache.org/licenses/LICENSE-2.0'\\n  contact:\\n    name: Streetlights API Developers\\n    url: https://example.com/contact\\n    email: contact@example.com\\n  termsOfService: https://www.apache.org/licenses/LICENSE-2.0\\nservers:\\n  mosquitto:\\n    host: test.mosquitto.org\\n    protocol: mqtt\\nchannels:\\n  lightMeasured:\\n    address: light/measured\\n    messages:\\n      lightMeasured:\\n        $ref: '#/components/messages/LightMeasured'\\noperations:\\n  onLightMeasured:\\n    action: receive\\n    channel:\\n      $ref: '#/channels/lightMeasured'\\n    summary: Inform about environmental lighting conditions for a particular streetlight\\ncomponents:\\n  messages:\\n    LightMeasured:\\n      name: LightMeasured\\n      payload:\\n        $ref: '#/components/schemas/LightMeasuredPayload'\\n  schemas:\\n    LightMeasuredPayload:\\n      type: object\\n      description: Payload for LightMeasured API\\n      required:\\n        - id\\n        - lumens\\n        - sentAt\\n      properties:\\n        id:\\n          type: integer\\n          minimum: 0\\n          description: Id of the streetlight\\n        lumens:\\n          type: integer\\n          minimum: 0\\n          description: Light intensity measured in lumens\\n        sentAt:\\n          type: string\\n          format: date-time\\n          description: Date and time when the message was sent\\n          minLength: 20\\n          maxLength: 29\",\n      \"path\": \"index.yaml\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create AsyncAPI 3.0 YAML Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Streetlights API",
  "type": "ASYNCAPI:3.0",
  "files": [
    [
      "content": "asyncapi: '3.0.0'
info:
  title: Streetlights API
  version: '1.0.0'
  description: |
    The Smartylighting Streetlights API allows you
    to remotely manage the city lights.
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'
  contact:
    name: Streetlights API Developers
    url: https://example.com/contact
    email: contact@example.com
  termsOfService: https://www.apache.org/licenses/LICENSE-2.0
servers:
  mosquitto:
    host: test.mosquitto.org
    protocol: mqtt
channels:
  lightMeasured:
    address: light/measured
    messages:
      lightMeasured:
        $ref: '#/components/messages/LightMeasured'
operations:
  onLightMeasured:
    action: receive
    channel:
      $ref: '#/channels/lightMeasured'
    summary: Inform about environmental lighting conditions for a particular streetlight
components:
  messages:
    LightMeasured:
      name: LightMeasured
      payload:
        $ref: '#/components/schemas/LightMeasuredPayload'
  schemas:
    LightMeasuredPayload:
      type: object
      description: Payload for LightMeasured API
      required:
        - id
        - lumens
        - sentAt
      properties:
        id:
          type: integer
          minimum: 0
          description: Id of the streetlight
        lumens:
          type: integer
          minimum: 0
          description: Light intensity measured in lumens
        sentAt:
          type: string
          format: date-time
          description: Date and time when the message was sent
          minLength: 20
          maxLength: 29",
      "path": "index.yaml",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create a GraphQL Spec



**Request**

```json
{
  "name": "Sample API",
  "type": "GRAPHQL",
  "files": [
    {
      "content": "schema {\n  query: Query\n  mutation: Mutation\n}\n\ntype User {\n  id: String!\n  name: String\n}\n\ntype Query {\n  user(id: String): User\n}\n\ntype Mutation {\n  addUser(name: String!): User!\n}",
      "path": "index.graphql",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create a GraphQL Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Sample API",
    "type": "GRAPHQL",
    "files": [
        {
            "content": "schema {
  query: Query
  mutation: Mutation
}

type User {
  id: String!
  name: String
}

type Query {
  user(id: String): User
}

type Mutation {
  addUser(name: String!): User!
}",
            "path": "index.graphql",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a GraphQL Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Sample API","type":"GRAPHQL","files":[{"content":"schema {\n  query: Query\n  mutation: Mutation\n}\n\ntype User {\n  id: String!\n  name: String\n}\n\ntype Query {\n  user(id: String): User\n}\n\ntype Mutation {\n  addUser(name: String!): User!\n}","path":"index.graphql","type":"DEFAULT"}]}'
};

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

```go Create a GraphQL Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Sample API\",\n  \"type\": \"GRAPHQL\",\n  \"files\": [\n    {\n      \"content\": \"schema {\\n  query: Query\\n  mutation: Mutation\\n}\\n\\ntype User {\\n  id: String!\\n  name: String\\n}\\n\\ntype Query {\\n  user(id: String): User\\n}\\n\\ntype Mutation {\\n  addUser(name: String!): User!\\n}\",\n      \"path\": \"index.graphql\",\n      \"type\": \"DEFAULT\"\n    }\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 Create a GraphQL Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Sample API\",\n  \"type\": \"GRAPHQL\",\n  \"files\": [\n    {\n      \"content\": \"schema {\\n  query: Query\\n  mutation: Mutation\\n}\\n\\ntype User {\\n  id: String!\\n  name: String\\n}\\n\\ntype Query {\\n  user(id: String): User\\n}\\n\\ntype Mutation {\\n  addUser(name: String!): User!\\n}\",\n      \"path\": \"index.graphql\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create a GraphQL Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Sample API\",\n  \"type\": \"GRAPHQL\",\n  \"files\": [\n    {\n      \"content\": \"schema {\\n  query: Query\\n  mutation: Mutation\\n}\\n\\ntype User {\\n  id: String!\\n  name: String\\n}\\n\\ntype Query {\\n  user(id: String): User\\n}\\n\\ntype Mutation {\\n  addUser(name: String!): User!\\n}\",\n      \"path\": \"index.graphql\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create a GraphQL Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Sample API",
  "type": "GRAPHQL",
  "files": [
    {
      "content": "schema {\\n  query: Query\\n  mutation: Mutation\\n}\\n\\ntype User {\\n  id: String!\\n  name: String\\n}\\n\\ntype Query {\\n  user(id: String): User\\n}\\n\\ntype Mutation {\\n  addUser(name: String!): User!\\n}",
      "path": "index.graphql",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create a GraphQL Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Sample API\",\n  \"type\": \"GRAPHQL\",\n  \"files\": [\n    {\n      \"content\": \"schema {\\n  query: Query\\n  mutation: Mutation\\n}\\n\\ntype User {\\n  id: String!\\n  name: String\\n}\\n\\ntype Query {\\n  user(id: String): User\\n}\\n\\ntype Mutation {\\n  addUser(name: String!): User!\\n}\",\n      \"path\": \"index.graphql\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a GraphQL Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Sample API",
  "type": "GRAPHQL",
  "files": [
    [
      "content": "schema {
  query: Query
  mutation: Mutation
}

type User {
  id: String!
  name: String
}

type Query {
  user(id: String): User
}

type Mutation {
  addUser(name: String!): User!
}",
      "path": "index.graphql",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create a Protobuf 2 Spec



**Request**

```json
{
  "name": "Sample API",
  "type": "PROTOBUF:2",
  "files": [
    {
      "content": "syntax = \"proto2\";\n\npackage com.addressBook;\n\nmessage Person {\n  required string name = 1;\n  required int32 id = 2;\n  optional string email = 3;\n}\n\nmessage AddressBook {\n  repeated Person people = 1;\n}\n\nmessage AddressBookById {\n  required int32 id = 1;\n}\n\nmessage AddressBookByName {\n  required string name = 1;\n}\n\nservice AddressBookService {\n  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}\n  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}\n  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}\n}",
      "path": "index.proto",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create a Protobuf 2 Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Sample API",
    "type": "PROTOBUF:2",
    "files": [
        {
            "content": "syntax = \"proto2\";

package com.addressBook;

message Person {
  required string name = 1;
  required int32 id = 2;
  optional string email = 3;
}

message AddressBook {
  repeated Person people = 1;
}

message AddressBookById {
  required int32 id = 1;
}

message AddressBookByName {
  required string name = 1;
}

service AddressBookService {
  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}
  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}
  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}
}",
            "path": "index.proto",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a Protobuf 2 Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Sample API","type":"PROTOBUF:2","files":[{"content":"syntax = \"proto2\";\n\npackage com.addressBook;\n\nmessage Person {\n  required string name = 1;\n  required int32 id = 2;\n  optional string email = 3;\n}\n\nmessage AddressBook {\n  repeated Person people = 1;\n}\n\nmessage AddressBookById {\n  required int32 id = 1;\n}\n\nmessage AddressBookByName {\n  required string name = 1;\n}\n\nservice AddressBookService {\n  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}\n  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}\n  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}\n}","path":"index.proto","type":"DEFAULT"}]}'
};

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

```go Create a Protobuf 2 Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:2\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto2\\\";\\n\\npackage com.addressBook;\\n\\nmessage Person {\\n  required string name = 1;\\n  required int32 id = 2;\\n  optional string email = 3;\\n}\\n\\nmessage AddressBook {\\n  repeated Person people = 1;\\n}\\n\\nmessage AddressBookById {\\n  required int32 id = 1;\\n}\\n\\nmessage AddressBookByName {\\n  required string name = 1;\\n}\\n\\nservice AddressBookService {\\n  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}\\n  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}\\n  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\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 Create a Protobuf 2 Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:2\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto2\\\";\\n\\npackage com.addressBook;\\n\\nmessage Person {\\n  required string name = 1;\\n  required int32 id = 2;\\n  optional string email = 3;\\n}\\n\\nmessage AddressBook {\\n  repeated Person people = 1;\\n}\\n\\nmessage AddressBookById {\\n  required int32 id = 1;\\n}\\n\\nmessage AddressBookByName {\\n  required string name = 1;\\n}\\n\\nservice AddressBookService {\\n  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}\\n  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}\\n  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create a Protobuf 2 Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:2\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto2\\\";\\n\\npackage com.addressBook;\\n\\nmessage Person {\\n  required string name = 1;\\n  required int32 id = 2;\\n  optional string email = 3;\\n}\\n\\nmessage AddressBook {\\n  repeated Person people = 1;\\n}\\n\\nmessage AddressBookById {\\n  required int32 id = 1;\\n}\\n\\nmessage AddressBookByName {\\n  required string name = 1;\\n}\\n\\nservice AddressBookService {\\n  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}\\n  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}\\n  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create a Protobuf 2 Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Sample API",
  "type": "PROTOBUF:2",
  "files": [
    {
      "content": "syntax = \\"proto2\\";\\n\\npackage com.addressBook;\\n\\nmessage Person {\\n  required string name = 1;\\n  required int32 id = 2;\\n  optional string email = 3;\\n}\\n\\nmessage AddressBook {\\n  repeated Person people = 1;\\n}\\n\\nmessage AddressBookById {\\n  required int32 id = 1;\\n}\\n\\nmessage AddressBookByName {\\n  required string name = 1;\\n}\\n\\nservice AddressBookService {\\n  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}\\n  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}\\n  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}\\n}",
      "path": "index.proto",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create a Protobuf 2 Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:2\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto2\\\";\\n\\npackage com.addressBook;\\n\\nmessage Person {\\n  required string name = 1;\\n  required int32 id = 2;\\n  optional string email = 3;\\n}\\n\\nmessage AddressBook {\\n  repeated Person people = 1;\\n}\\n\\nmessage AddressBookById {\\n  required int32 id = 1;\\n}\\n\\nmessage AddressBookByName {\\n  required string name = 1;\\n}\\n\\nservice AddressBookService {\\n  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}\\n  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}\\n  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a Protobuf 2 Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Sample API",
  "type": "PROTOBUF:2",
  "files": [
    [
      "content": "syntax = \"proto2\";

package com.addressBook;

message Person {
  required string name = 1;
  required int32 id = 2;
  optional string email = 3;
}

message AddressBook {
  repeated Person people = 1;
}

message AddressBookById {
  required int32 id = 1;
}

message AddressBookByName {
  required string name = 1;
}

service AddressBookService {
  rpc CreateAddressBook (AddressBook) returns (AddressBook) {}
  rpc GetAddressBook (AddressBookById) returns (AddressBook) {}
  rpc ListAddressBook (AddressBookByName) returns (stream AddressBook) {}
}",
      "path": "index.proto",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create a Protobuf 3 Spec



**Request**

```json
{
  "name": "Sample API",
  "type": "PROTOBUF:3",
  "files": [
    {
      "content": "syntax = \"proto3\";\n\npackage com.book;\n\nmessage Book {\n  int64 isbn = 1;\n  string title = 2;\n  string author = 3;\n}\n\nmessage GetBookRequest {\n  int64 isbn = 1;\n}\n\nmessage GetBookViaAuthor {\n  string author = 1;\n}\n\nservice BookService {\n  rpc GetBook (GetBookRequest) returns (Book) {}\n  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}\n  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}\n  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}\n}",
      "path": "index.proto",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create a Protobuf 3 Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Sample API",
    "type": "PROTOBUF:3",
    "files": [
        {
            "content": "syntax = \"proto3\";

package com.book;

message Book {
  int64 isbn = 1;
  string title = 2;
  string author = 3;
}

message GetBookRequest {
  int64 isbn = 1;
}

message GetBookViaAuthor {
  string author = 1;
}

service BookService {
  rpc GetBook (GetBookRequest) returns (Book) {}
  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}
  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}
  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}
}",
            "path": "index.proto",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a Protobuf 3 Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Sample API","type":"PROTOBUF:3","files":[{"content":"syntax = \"proto3\";\n\npackage com.book;\n\nmessage Book {\n  int64 isbn = 1;\n  string title = 2;\n  string author = 3;\n}\n\nmessage GetBookRequest {\n  int64 isbn = 1;\n}\n\nmessage GetBookViaAuthor {\n  string author = 1;\n}\n\nservice BookService {\n  rpc GetBook (GetBookRequest) returns (Book) {}\n  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}\n  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}\n  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}\n}","path":"index.proto","type":"DEFAULT"}]}'
};

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

```go Create a Protobuf 3 Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:3\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto3\\\";\\n\\npackage com.book;\\n\\nmessage Book {\\n  int64 isbn = 1;\\n  string title = 2;\\n  string author = 3;\\n}\\n\\nmessage GetBookRequest {\\n  int64 isbn = 1;\\n}\\n\\nmessage GetBookViaAuthor {\\n  string author = 1;\\n}\\n\\nservice BookService {\\n  rpc GetBook (GetBookRequest) returns (Book) {}\\n  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}\\n  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}\\n  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\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 Create a Protobuf 3 Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:3\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto3\\\";\\n\\npackage com.book;\\n\\nmessage Book {\\n  int64 isbn = 1;\\n  string title = 2;\\n  string author = 3;\\n}\\n\\nmessage GetBookRequest {\\n  int64 isbn = 1;\\n}\\n\\nmessage GetBookViaAuthor {\\n  string author = 1;\\n}\\n\\nservice BookService {\\n  rpc GetBook (GetBookRequest) returns (Book) {}\\n  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}\\n  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}\\n  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create a Protobuf 3 Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:3\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto3\\\";\\n\\npackage com.book;\\n\\nmessage Book {\\n  int64 isbn = 1;\\n  string title = 2;\\n  string author = 3;\\n}\\n\\nmessage GetBookRequest {\\n  int64 isbn = 1;\\n}\\n\\nmessage GetBookViaAuthor {\\n  string author = 1;\\n}\\n\\nservice BookService {\\n  rpc GetBook (GetBookRequest) returns (Book) {}\\n  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}\\n  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}\\n  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create a Protobuf 3 Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Sample API",
  "type": "PROTOBUF:3",
  "files": [
    {
      "content": "syntax = \\"proto3\\";\\n\\npackage com.book;\\n\\nmessage Book {\\n  int64 isbn = 1;\\n  string title = 2;\\n  string author = 3;\\n}\\n\\nmessage GetBookRequest {\\n  int64 isbn = 1;\\n}\\n\\nmessage GetBookViaAuthor {\\n  string author = 1;\\n}\\n\\nservice BookService {\\n  rpc GetBook (GetBookRequest) returns (Book) {}\\n  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}\\n  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}\\n  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}\\n}",
      "path": "index.proto",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create a Protobuf 3 Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Sample API\",\n  \"type\": \"PROTOBUF:3\",\n  \"files\": [\n    {\n      \"content\": \"syntax = \\\"proto3\\\";\\n\\npackage com.book;\\n\\nmessage Book {\\n  int64 isbn = 1;\\n  string title = 2;\\n  string author = 3;\\n}\\n\\nmessage GetBookRequest {\\n  int64 isbn = 1;\\n}\\n\\nmessage GetBookViaAuthor {\\n  string author = 1;\\n}\\n\\nservice BookService {\\n  rpc GetBook (GetBookRequest) returns (Book) {}\\n  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}\\n  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}\\n  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}\\n}\",\n      \"path\": \"index.proto\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a Protobuf 3 Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Sample API",
  "type": "PROTOBUF:3",
  "files": [
    [
      "content": "syntax = \"proto3\";

package com.book;

message Book {
  int64 isbn = 1;
  string title = 2;
  string author = 3;
}

message GetBookRequest {
  int64 isbn = 1;
}

message GetBookViaAuthor {
  string author = 1;
}

service BookService {
  rpc GetBook (GetBookRequest) returns (Book) {}
  rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}
  rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}
  rpc GetBooks (stream GetBookRequest) returns (stream Book) {}
}",
      "path": "index.proto",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create a Smithy Spec



**Request**

```json
{
  "name": "Sample API",
  "type": "SMITHY:2.0",
  "files": [
    {
      "content": "$version: \"2\"\n\nnamespace com.example\n\nuse aws.protocols#restJson1\n\n/// A simple greeting service\n@restJson1\nservice GreetingService {\n    version: \"2024-01-01\"\n    operations: [GetGreeting, CreateGreeting]\n    errors: [ValidationError]\n}\n\n/// Returns a greeting for the given name\n@http(method: \"GET\", uri: \"/greeting/{name}\", code: 200)\n@readonly\noperation GetGreeting {\n    input := {\n        /// The name to greet\n        @required\n        @httpLabel\n        name: String\n    }\n    output := {\n        /// The greeting message\n        @required\n        message: String\n    }\n    errors: [GreetingNotFoundError]\n}\n\n/// Creates a new greeting\n@http(method: \"POST\", uri: \"/greeting\", code: 201)\noperation CreateGreeting {\n    input := {\n        /// The name to greet\n        @required\n        name: String\n\n        /// Optional custom message prefix\n        prefix: String = \"Hello\"\n    }\n    output := {\n        /// The created greeting message\n        @required\n        message: String\n    }\n}\n\n/// Thrown when a greeting is not found\n@error(\"client\")\n@httpError(404)\nstructure GreetingNotFoundError {\n    @required\n    message: String\n}\n\n/// Thrown when the request input is invalid\n@error(\"client\")\n@httpError(400)\nstructure ValidationError {\n    @required\n    message: String\n\n    /// Field-level validation errors\n    fieldErrors: FieldErrorMap\n}\n\nmap FieldErrorMap {\n    key: String\n    value: String\n}\n",
      "path": "main.smithy",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create a Smithy Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Sample API",
    "type": "SMITHY:2.0",
    "files": [
        {
            "content": "$version: \"2\"

namespace com.example

use aws.protocols#restJson1

/// A simple greeting service
@restJson1
service GreetingService {
    version: \"2024-01-01\"
    operations: [GetGreeting, CreateGreeting]
    errors: [ValidationError]
}

/// Returns a greeting for the given name
@http(method: \"GET\", uri: \"/greeting/{name}\", code: 200)
@readonly
operation GetGreeting {
    input := {
        /// The name to greet
        @required
        @httpLabel
        name: String
    }
    output := {
        /// The greeting message
        @required
        message: String
    }
    errors: [GreetingNotFoundError]
}

/// Creates a new greeting
@http(method: \"POST\", uri: \"/greeting\", code: 201)
operation CreateGreeting {
    input := {
        /// The name to greet
        @required
        name: String

        /// Optional custom message prefix
        prefix: String = \"Hello\"
    }
    output := {
        /// The created greeting message
        @required
        message: String
    }
}

/// Thrown when a greeting is not found
@error(\"client\")
@httpError(404)
structure GreetingNotFoundError {
    @required
    message: String
}

/// Thrown when the request input is invalid
@error(\"client\")
@httpError(400)
structure ValidationError {
    @required
    message: String

    /// Field-level validation errors
    fieldErrors: FieldErrorMap
}

map FieldErrorMap {
    key: String
    value: String
}
",
            "path": "main.smithy",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a Smithy Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Sample API","type":"SMITHY:2.0","files":[{"content":"$version: \"2\"\n\nnamespace com.example\n\nuse aws.protocols#restJson1\n\n/// A simple greeting service\n@restJson1\nservice GreetingService {\n    version: \"2024-01-01\"\n    operations: [GetGreeting, CreateGreeting]\n    errors: [ValidationError]\n}\n\n/// Returns a greeting for the given name\n@http(method: \"GET\", uri: \"/greeting/{name}\", code: 200)\n@readonly\noperation GetGreeting {\n    input := {\n        /// The name to greet\n        @required\n        @httpLabel\n        name: String\n    }\n    output := {\n        /// The greeting message\n        @required\n        message: String\n    }\n    errors: [GreetingNotFoundError]\n}\n\n/// Creates a new greeting\n@http(method: \"POST\", uri: \"/greeting\", code: 201)\noperation CreateGreeting {\n    input := {\n        /// The name to greet\n        @required\n        name: String\n\n        /// Optional custom message prefix\n        prefix: String = \"Hello\"\n    }\n    output := {\n        /// The created greeting message\n        @required\n        message: String\n    }\n}\n\n/// Thrown when a greeting is not found\n@error(\"client\")\n@httpError(404)\nstructure GreetingNotFoundError {\n    @required\n    message: String\n}\n\n/// Thrown when the request input is invalid\n@error(\"client\")\n@httpError(400)\nstructure ValidationError {\n    @required\n    message: String\n\n    /// Field-level validation errors\n    fieldErrors: FieldErrorMap\n}\n\nmap FieldErrorMap {\n    key: String\n    value: String\n}\n","path":"main.smithy","type":"DEFAULT"}]}'
};

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

```go Create a Smithy Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Sample API\",\n  \"type\": \"SMITHY:2.0\",\n  \"files\": [\n    {\n      \"content\": \"$version: \\\"2\\\"\\n\\nnamespace com.example\\n\\nuse aws.protocols#restJson1\\n\\n/// A simple greeting service\\n@restJson1\\nservice GreetingService {\\n    version: \\\"2024-01-01\\\"\\n    operations: [GetGreeting, CreateGreeting]\\n    errors: [ValidationError]\\n}\\n\\n/// Returns a greeting for the given name\\n@http(method: \\\"GET\\\", uri: \\\"/greeting/{name}\\\", code: 200)\\n@readonly\\noperation GetGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        @httpLabel\\n        name: String\\n    }\\n    output := {\\n        /// The greeting message\\n        @required\\n        message: String\\n    }\\n    errors: [GreetingNotFoundError]\\n}\\n\\n/// Creates a new greeting\\n@http(method: \\\"POST\\\", uri: \\\"/greeting\\\", code: 201)\\noperation CreateGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        name: String\\n\\n        /// Optional custom message prefix\\n        prefix: String = \\\"Hello\\\"\\n    }\\n    output := {\\n        /// The created greeting message\\n        @required\\n        message: String\\n    }\\n}\\n\\n/// Thrown when a greeting is not found\\n@error(\\\"client\\\")\\n@httpError(404)\\nstructure GreetingNotFoundError {\\n    @required\\n    message: String\\n}\\n\\n/// Thrown when the request input is invalid\\n@error(\\\"client\\\")\\n@httpError(400)\\nstructure ValidationError {\\n    @required\\n    message: String\\n\\n    /// Field-level validation errors\\n    fieldErrors: FieldErrorMap\\n}\\n\\nmap FieldErrorMap {\\n    key: String\\n    value: String\\n}\\n\",\n      \"path\": \"main.smithy\",\n      \"type\": \"DEFAULT\"\n    }\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 Create a Smithy Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Sample API\",\n  \"type\": \"SMITHY:2.0\",\n  \"files\": [\n    {\n      \"content\": \"$version: \\\"2\\\"\\n\\nnamespace com.example\\n\\nuse aws.protocols#restJson1\\n\\n/// A simple greeting service\\n@restJson1\\nservice GreetingService {\\n    version: \\\"2024-01-01\\\"\\n    operations: [GetGreeting, CreateGreeting]\\n    errors: [ValidationError]\\n}\\n\\n/// Returns a greeting for the given name\\n@http(method: \\\"GET\\\", uri: \\\"/greeting/{name}\\\", code: 200)\\n@readonly\\noperation GetGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        @httpLabel\\n        name: String\\n    }\\n    output := {\\n        /// The greeting message\\n        @required\\n        message: String\\n    }\\n    errors: [GreetingNotFoundError]\\n}\\n\\n/// Creates a new greeting\\n@http(method: \\\"POST\\\", uri: \\\"/greeting\\\", code: 201)\\noperation CreateGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        name: String\\n\\n        /// Optional custom message prefix\\n        prefix: String = \\\"Hello\\\"\\n    }\\n    output := {\\n        /// The created greeting message\\n        @required\\n        message: String\\n    }\\n}\\n\\n/// Thrown when a greeting is not found\\n@error(\\\"client\\\")\\n@httpError(404)\\nstructure GreetingNotFoundError {\\n    @required\\n    message: String\\n}\\n\\n/// Thrown when the request input is invalid\\n@error(\\\"client\\\")\\n@httpError(400)\\nstructure ValidationError {\\n    @required\\n    message: String\\n\\n    /// Field-level validation errors\\n    fieldErrors: FieldErrorMap\\n}\\n\\nmap FieldErrorMap {\\n    key: String\\n    value: String\\n}\\n\",\n      \"path\": \"main.smithy\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create a Smithy Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Sample API\",\n  \"type\": \"SMITHY:2.0\",\n  \"files\": [\n    {\n      \"content\": \"$version: \\\"2\\\"\\n\\nnamespace com.example\\n\\nuse aws.protocols#restJson1\\n\\n/// A simple greeting service\\n@restJson1\\nservice GreetingService {\\n    version: \\\"2024-01-01\\\"\\n    operations: [GetGreeting, CreateGreeting]\\n    errors: [ValidationError]\\n}\\n\\n/// Returns a greeting for the given name\\n@http(method: \\\"GET\\\", uri: \\\"/greeting/{name}\\\", code: 200)\\n@readonly\\noperation GetGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        @httpLabel\\n        name: String\\n    }\\n    output := {\\n        /// The greeting message\\n        @required\\n        message: String\\n    }\\n    errors: [GreetingNotFoundError]\\n}\\n\\n/// Creates a new greeting\\n@http(method: \\\"POST\\\", uri: \\\"/greeting\\\", code: 201)\\noperation CreateGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        name: String\\n\\n        /// Optional custom message prefix\\n        prefix: String = \\\"Hello\\\"\\n    }\\n    output := {\\n        /// The created greeting message\\n        @required\\n        message: String\\n    }\\n}\\n\\n/// Thrown when a greeting is not found\\n@error(\\\"client\\\")\\n@httpError(404)\\nstructure GreetingNotFoundError {\\n    @required\\n    message: String\\n}\\n\\n/// Thrown when the request input is invalid\\n@error(\\\"client\\\")\\n@httpError(400)\\nstructure ValidationError {\\n    @required\\n    message: String\\n\\n    /// Field-level validation errors\\n    fieldErrors: FieldErrorMap\\n}\\n\\nmap FieldErrorMap {\\n    key: String\\n    value: String\\n}\\n\",\n      \"path\": \"main.smithy\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create a Smithy Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Sample API",
  "type": "SMITHY:2.0",
  "files": [
    {
      "content": "$version: \\"2\\"\\n\\nnamespace com.example\\n\\nuse aws.protocols#restJson1\\n\\n/// A simple greeting service\\n@restJson1\\nservice GreetingService {\\n    version: \\"2024-01-01\\"\\n    operations: [GetGreeting, CreateGreeting]\\n    errors: [ValidationError]\\n}\\n\\n/// Returns a greeting for the given name\\n@http(method: \\"GET\\", uri: \\"/greeting/{name}\\", code: 200)\\n@readonly\\noperation GetGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        @httpLabel\\n        name: String\\n    }\\n    output := {\\n        /// The greeting message\\n        @required\\n        message: String\\n    }\\n    errors: [GreetingNotFoundError]\\n}\\n\\n/// Creates a new greeting\\n@http(method: \\"POST\\", uri: \\"/greeting\\", code: 201)\\noperation CreateGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        name: String\\n\\n        /// Optional custom message prefix\\n        prefix: String = \\"Hello\\"\\n    }\\n    output := {\\n        /// The created greeting message\\n        @required\\n        message: String\\n    }\\n}\\n\\n/// Thrown when a greeting is not found\\n@error(\\"client\\")\\n@httpError(404)\\nstructure GreetingNotFoundError {\\n    @required\\n    message: String\\n}\\n\\n/// Thrown when the request input is invalid\\n@error(\\"client\\")\\n@httpError(400)\\nstructure ValidationError {\\n    @required\\n    message: String\\n\\n    /// Field-level validation errors\\n    fieldErrors: FieldErrorMap\\n}\\n\\nmap FieldErrorMap {\\n    key: String\\n    value: String\\n}\\n",
      "path": "main.smithy",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create a Smithy Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Sample API\",\n  \"type\": \"SMITHY:2.0\",\n  \"files\": [\n    {\n      \"content\": \"$version: \\\"2\\\"\\n\\nnamespace com.example\\n\\nuse aws.protocols#restJson1\\n\\n/// A simple greeting service\\n@restJson1\\nservice GreetingService {\\n    version: \\\"2024-01-01\\\"\\n    operations: [GetGreeting, CreateGreeting]\\n    errors: [ValidationError]\\n}\\n\\n/// Returns a greeting for the given name\\n@http(method: \\\"GET\\\", uri: \\\"/greeting/{name}\\\", code: 200)\\n@readonly\\noperation GetGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        @httpLabel\\n        name: String\\n    }\\n    output := {\\n        /// The greeting message\\n        @required\\n        message: String\\n    }\\n    errors: [GreetingNotFoundError]\\n}\\n\\n/// Creates a new greeting\\n@http(method: \\\"POST\\\", uri: \\\"/greeting\\\", code: 201)\\noperation CreateGreeting {\\n    input := {\\n        /// The name to greet\\n        @required\\n        name: String\\n\\n        /// Optional custom message prefix\\n        prefix: String = \\\"Hello\\\"\\n    }\\n    output := {\\n        /// The created greeting message\\n        @required\\n        message: String\\n    }\\n}\\n\\n/// Thrown when a greeting is not found\\n@error(\\\"client\\\")\\n@httpError(404)\\nstructure GreetingNotFoundError {\\n    @required\\n    message: String\\n}\\n\\n/// Thrown when the request input is invalid\\n@error(\\\"client\\\")\\n@httpError(400)\\nstructure ValidationError {\\n    @required\\n    message: String\\n\\n    /// Field-level validation errors\\n    fieldErrors: FieldErrorMap\\n}\\n\\nmap FieldErrorMap {\\n    key: String\\n    value: String\\n}\\n\",\n      \"path\": \"main.smithy\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a Smithy Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Sample API",
  "type": "SMITHY:2.0",
  "files": [
    [
      "content": "$version: \"2\"

namespace com.example

use aws.protocols#restJson1

/// A simple greeting service
@restJson1
service GreetingService {
    version: \"2024-01-01\"
    operations: [GetGreeting, CreateGreeting]
    errors: [ValidationError]
}

/// Returns a greeting for the given name
@http(method: \"GET\", uri: \"/greeting/{name}\", code: 200)
@readonly
operation GetGreeting {
    input := {
        /// The name to greet
        @required
        @httpLabel
        name: String
    }
    output := {
        /// The greeting message
        @required
        message: String
    }
    errors: [GreetingNotFoundError]
}

/// Creates a new greeting
@http(method: \"POST\", uri: \"/greeting\", code: 201)
operation CreateGreeting {
    input := {
        /// The name to greet
        @required
        name: String

        /// Optional custom message prefix
        prefix: String = \"Hello\"
    }
    output := {
        /// The created greeting message
        @required
        message: String
    }
}

/// Thrown when a greeting is not found
@error(\"client\")
@httpError(404)
structure GreetingNotFoundError {
    @required
    message: String
}

/// Thrown when the request input is invalid
@error(\"client\")
@httpError(400)
structure ValidationError {
    @required
    message: String

    /// Field-level validation errors
    fieldErrors: FieldErrorMap
}

map FieldErrorMap {
    key: String
    value: String
}
",
      "path": "main.smithy",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```

### Create Multi-File Spec



**Request**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    {
      "content": "{\n    \"openapi\": \"3.0.0\",\n    \"servers\": [\n        {\n            \"url\": \"example.com\"\n        }\n    ],\n    \"info\": {\n        \"contact\": {\n            \"name\": \"Jon\"\n        },\n        \"version\": \"1.0.0\",\n        \"title\": \"Sample API\",\n        \"description\": \"Buy or rent spacecrafts\"\n    },\n    \"paths\": {\n        \"/spacecrafts/{spacecraftId}\": {\n            \"parameters\": [\n                {\n                    \"name\": \"spacecraftId\",\n                    \"description\": \"The unique identifier of the spacecraft\",\n                    \"in\": \"path\",\n                    \"required\": true,\n                    \"schema\": {\n                        \"$ref\": \"schemas.json#/SpacecraftId\"\n                    }\n                }\n            ],\n            \"get\": {\n                \"summary\": \"Read a spacecraft\",\n                \"description\": \"Get information about a spacecraft.\",\n                \"operationId\": \"getSpacecraft\",\n                \"tags\": [\n                    \"Spacecrafts\"\n                ],\n                \"responses\": {\n                    \"200\": {\n                        \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n                        \"content\": {\n                            \"application/json\": {\n                                \"schema\": {\n                                    \"$ref\": \"schemas.json#/Spacecraft\"\n                                }\n                            }\n                        }\n                    },\n                    \"404\": {\n                        \"description\": \"No spacecraft found for the provided `spacecraftId`\",\n                        \"content\": {\n                            \"application/json\": {\n                                \"schema\": {\n                                    \"$ref\": \"schemas.json#/Error\"\n                                }\n                            }\n                        }\n                    },\n                    \"500\": {\n                        \"description\": \"Unexpected error\",\n                        \"content\": {\n                            \"application/json\": {\n                                \"schema\": {\n                                    \"$ref\": \"schemas.json#/Error\"\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    },\n    \"components\": {\n        \"securitySchemes\": {\n            \"ApiKey\": {\n                \"type\": \"apiKey\",\n                \"in\": \"header\",\n                \"name\": \"x-api-key\"\n            }\n        }\n    },\n    \"tags\": [\n        {\n            \"name\": \"Spacecrafts\"\n        }\n    ],\n    \"security\": [\n        {\n            \"ApiKey\": []\n        }\n    ]\n}",
      "path": "index.json",
      "type": "ROOT"
    },
    {
      "content": "{\n    \"SpacecraftId\": {\n        \"description\": \"The unique identifier of a spacecraft\",\n        \"type\": \"string\"\n    },\n    \"Spacecraft\": {\n        \"type\": \"object\",\n        \"required\": [\n            \"id\",\n            \"name\",\n            \"type\"\n        ],\n        \"properties\": {\n            \"id\": {\n                \"$ref\": \"#/SpacecraftId\"\n            },\n            \"name\": {\n                \"type\": \"string\"\n            },\n            \"type\": {\n                \"type\": \"string\",\n                \"enum\": [\n                    \"capsule\",\n                    \"probe\",\n                    \"satellite\",\n                    \"spaceplane\",\n                    \"station\"\n                ]\n            },\n            \"description\": {\n                \"type\": \"string\"\n            }\n        }\n    },\n    \"Error\": {\n        \"type\": \"object\",\n        \"required\": [\n            \"message\"\n        ],\n        \"properties\": {\n            \"message\": {\n                \"description\": \"A human readable error message\",\n                \"type\": \"string\"\n            }\n        }\n    }\n}",
      "path": "schemas.json",
      "type": "DEFAULT"
    }
  ]
}
```

**Response**

```json
{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "id": "b4fc1bdc-6587-4f9b-95c9-f768146089b4",
  "createdAt": "2025-03-15T13:48:28.000Z",
  "updatedAt": "2025-03-15T13:48:28.000Z",
  "createdBy": 12345678,
  "updatedBy": 12345678
}
```

**SDK Code**

```python Create Multi-File Spec
import requests

url = "https://api.getpostman.com/specs"

querystring = {"workspaceId":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"}

payload = {
    "name": "Sample API",
    "type": "OPENAPI:3.0",
    "files": [
        {
            "content": "{
    \"openapi\": \"3.0.0\",
    \"servers\": [
        {
            \"url\": \"example.com\"
        }
    ],
    \"info\": {
        \"contact\": {
            \"name\": \"Jon\"
        },
        \"version\": \"1.0.0\",
        \"title\": \"Sample API\",
        \"description\": \"Buy or rent spacecrafts\"
    },
    \"paths\": {
        \"/spacecrafts/{spacecraftId}\": {
            \"parameters\": [
                {
                    \"name\": \"spacecraftId\",
                    \"description\": \"The unique identifier of the spacecraft\",
                    \"in\": \"path\",
                    \"required\": true,
                    \"schema\": {
                        \"$ref\": \"schemas.json#/SpacecraftId\"
                    }
                }
            ],
            \"get\": {
                \"summary\": \"Read a spacecraft\",
                \"description\": \"Get information about a spacecraft.\",
                \"operationId\": \"getSpacecraft\",
                \"tags\": [
                    \"Spacecrafts\"
                ],
                \"responses\": {
                    \"200\": {
                        \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",
                        \"content\": {
                            \"application/json\": {
                                \"schema\": {
                                    \"$ref\": \"schemas.json#/Spacecraft\"
                                }
                            }
                        }
                    },
                    \"404\": {
                        \"description\": \"No spacecraft found for the provided `spacecraftId`\",
                        \"content\": {
                            \"application/json\": {
                                \"schema\": {
                                    \"$ref\": \"schemas.json#/Error\"
                                }
                            }
                        }
                    },
                    \"500\": {
                        \"description\": \"Unexpected error\",
                        \"content\": {
                            \"application/json\": {
                                \"schema\": {
                                    \"$ref\": \"schemas.json#/Error\"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    \"components\": {
        \"securitySchemes\": {
            \"ApiKey\": {
                \"type\": \"apiKey\",
                \"in\": \"header\",
                \"name\": \"x-api-key\"
            }
        }
    },
    \"tags\": [
        {
            \"name\": \"Spacecrafts\"
        }
    ],
    \"security\": [
        {
            \"ApiKey\": []
        }
    ]
}",
            "path": "index.json",
            "type": "ROOT"
        },
        {
            "content": "{
    \"SpacecraftId\": {
        \"description\": \"The unique identifier of a spacecraft\",
        \"type\": \"string\"
    },
    \"Spacecraft\": {
        \"type\": \"object\",
        \"required\": [
            \"id\",
            \"name\",
            \"type\"
        ],
        \"properties\": {
            \"id\": {
                \"$ref\": \"#/SpacecraftId\"
            },
            \"name\": {
                \"type\": \"string\"
            },
            \"type\": {
                \"type\": \"string\",
                \"enum\": [
                    \"capsule\",
                    \"probe\",
                    \"satellite\",
                    \"spaceplane\",
                    \"station\"
                ]
            },
            \"description\": {
                \"type\": \"string\"
            }
        }
    },
    \"Error\": {
        \"type\": \"object\",
        \"required\": [
            \"message\"
        ],
        \"properties\": {
            \"message\": {
                \"description\": \"A human readable error message\",
                \"type\": \"string\"
            }
        }
    }
}",
            "path": "schemas.json",
            "type": "DEFAULT"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create Multi-File Spec
const url = 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Sample API","type":"OPENAPI:3.0","files":[{"content":"{\n    \"openapi\": \"3.0.0\",\n    \"servers\": [\n        {\n            \"url\": \"example.com\"\n        }\n    ],\n    \"info\": {\n        \"contact\": {\n            \"name\": \"Jon\"\n        },\n        \"version\": \"1.0.0\",\n        \"title\": \"Sample API\",\n        \"description\": \"Buy or rent spacecrafts\"\n    },\n    \"paths\": {\n        \"/spacecrafts/{spacecraftId}\": {\n            \"parameters\": [\n                {\n                    \"name\": \"spacecraftId\",\n                    \"description\": \"The unique identifier of the spacecraft\",\n                    \"in\": \"path\",\n                    \"required\": true,\n                    \"schema\": {\n                        \"$ref\": \"schemas.json#/SpacecraftId\"\n                    }\n                }\n            ],\n            \"get\": {\n                \"summary\": \"Read a spacecraft\",\n                \"description\": \"Get information about a spacecraft.\",\n                \"operationId\": \"getSpacecraft\",\n                \"tags\": [\n                    \"Spacecrafts\"\n                ],\n                \"responses\": {\n                    \"200\": {\n                        \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",\n                        \"content\": {\n                            \"application/json\": {\n                                \"schema\": {\n                                    \"$ref\": \"schemas.json#/Spacecraft\"\n                                }\n                            }\n                        }\n                    },\n                    \"404\": {\n                        \"description\": \"No spacecraft found for the provided `spacecraftId`\",\n                        \"content\": {\n                            \"application/json\": {\n                                \"schema\": {\n                                    \"$ref\": \"schemas.json#/Error\"\n                                }\n                            }\n                        }\n                    },\n                    \"500\": {\n                        \"description\": \"Unexpected error\",\n                        \"content\": {\n                            \"application/json\": {\n                                \"schema\": {\n                                    \"$ref\": \"schemas.json#/Error\"\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    },\n    \"components\": {\n        \"securitySchemes\": {\n            \"ApiKey\": {\n                \"type\": \"apiKey\",\n                \"in\": \"header\",\n                \"name\": \"x-api-key\"\n            }\n        }\n    },\n    \"tags\": [\n        {\n            \"name\": \"Spacecrafts\"\n        }\n    ],\n    \"security\": [\n        {\n            \"ApiKey\": []\n        }\n    ]\n}","path":"index.json","type":"ROOT"},{"content":"{\n    \"SpacecraftId\": {\n        \"description\": \"The unique identifier of a spacecraft\",\n        \"type\": \"string\"\n    },\n    \"Spacecraft\": {\n        \"type\": \"object\",\n        \"required\": [\n            \"id\",\n            \"name\",\n            \"type\"\n        ],\n        \"properties\": {\n            \"id\": {\n                \"$ref\": \"#/SpacecraftId\"\n            },\n            \"name\": {\n                \"type\": \"string\"\n            },\n            \"type\": {\n                \"type\": \"string\",\n                \"enum\": [\n                    \"capsule\",\n                    \"probe\",\n                    \"satellite\",\n                    \"spaceplane\",\n                    \"station\"\n                ]\n            },\n            \"description\": {\n                \"type\": \"string\"\n            }\n        }\n    },\n    \"Error\": {\n        \"type\": \"object\",\n        \"required\": [\n            \"message\"\n        ],\n        \"properties\": {\n            \"message\": {\n                \"description\": \"A human readable error message\",\n                \"type\": \"string\"\n            }\n        }\n    }\n}","path":"schemas.json","type":"DEFAULT"}]}'
};

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

```go Create Multi-File Spec
package main

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

func main() {

	url := "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9"

	payload := strings.NewReader("{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"openapi\\\": \\\"3.0.0\\\",\\n    \\\"servers\\\": [\\n        {\\n            \\\"url\\\": \\\"example.com\\\"\\n        }\\n    ],\\n    \\\"info\\\": {\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Jon\\\"\\n        },\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"title\\\": \\\"Sample API\\\",\\n        \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n    },\\n    \\\"paths\\\": {\\n        \\\"/spacecrafts/{spacecraftId}\\\": {\\n            \\\"parameters\\\": [\\n                {\\n                    \\\"name\\\": \\\"spacecraftId\\\",\\n                    \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n                    \\\"in\\\": \\\"path\\\",\\n                    \\\"required\\\": true,\\n                    \\\"schema\\\": {\\n                        \\\"$ref\\\": \\\"schemas.json#/SpacecraftId\\\"\\n                    }\\n                }\\n            ],\\n            \\\"get\\\": {\\n                \\\"summary\\\": \\\"Read a spacecraft\\\",\\n                \\\"description\\\": \\\"Get information about a spacecraft.\\\",\\n                \\\"operationId\\\": \\\"getSpacecraft\\\",\\n                \\\"tags\\\": [\\n                    \\\"Spacecrafts\\\"\\n                ],\\n                \\\"responses\\\": {\\n                    \\\"200\\\": {\\n                        \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Spacecraft\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"404\\\": {\\n                        \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"500\\\": {\\n                        \\\"description\\\": \\\"Unexpected error\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    }\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"securitySchemes\\\": {\\n            \\\"ApiKey\\\": {\\n                \\\"type\\\": \\\"apiKey\\\",\\n                \\\"in\\\": \\\"header\\\",\\n                \\\"name\\\": \\\"x-api-key\\\"\\n            }\\n        }\\n    },\\n    \\\"tags\\\": [\\n        {\\n            \\\"name\\\": \\\"Spacecrafts\\\"\\n        }\\n    ],\\n    \\\"security\\\": [\\n        {\\n            \\\"ApiKey\\\": []\\n        }\\n    ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"ROOT\"\n    },\n    {\n      \"content\": \"{\\n    \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n    },\\n    \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"id\\\",\\n            \\\"name\\\",\\n            \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"id\\\": {\\n                \\\"$ref\\\": \\\"#/SpacecraftId\\\"\\n            },\\n            \\\"name\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            },\\n            \\\"type\\\": {\\n                \\\"type\\\": \\\"string\\\",\\n                \\\"enum\\\": [\\n                    \\\"capsule\\\",\\n                    \\\"probe\\\",\\n                    \\\"satellite\\\",\\n                    \\\"spaceplane\\\",\\n                    \\\"station\\\"\\n                ]\\n            },\\n            \\\"description\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    },\\n    \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"message\\\": {\\n                \\\"description\\\": \\\"A human readable error message\\\",\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"schemas.json\",\n      \"type\": \"DEFAULT\"\n    }\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 Create Multi-File Spec
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")

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  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"openapi\\\": \\\"3.0.0\\\",\\n    \\\"servers\\\": [\\n        {\\n            \\\"url\\\": \\\"example.com\\\"\\n        }\\n    ],\\n    \\\"info\\\": {\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Jon\\\"\\n        },\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"title\\\": \\\"Sample API\\\",\\n        \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n    },\\n    \\\"paths\\\": {\\n        \\\"/spacecrafts/{spacecraftId}\\\": {\\n            \\\"parameters\\\": [\\n                {\\n                    \\\"name\\\": \\\"spacecraftId\\\",\\n                    \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n                    \\\"in\\\": \\\"path\\\",\\n                    \\\"required\\\": true,\\n                    \\\"schema\\\": {\\n                        \\\"$ref\\\": \\\"schemas.json#/SpacecraftId\\\"\\n                    }\\n                }\\n            ],\\n            \\\"get\\\": {\\n                \\\"summary\\\": \\\"Read a spacecraft\\\",\\n                \\\"description\\\": \\\"Get information about a spacecraft.\\\",\\n                \\\"operationId\\\": \\\"getSpacecraft\\\",\\n                \\\"tags\\\": [\\n                    \\\"Spacecrafts\\\"\\n                ],\\n                \\\"responses\\\": {\\n                    \\\"200\\\": {\\n                        \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Spacecraft\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"404\\\": {\\n                        \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"500\\\": {\\n                        \\\"description\\\": \\\"Unexpected error\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    }\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"securitySchemes\\\": {\\n            \\\"ApiKey\\\": {\\n                \\\"type\\\": \\\"apiKey\\\",\\n                \\\"in\\\": \\\"header\\\",\\n                \\\"name\\\": \\\"x-api-key\\\"\\n            }\\n        }\\n    },\\n    \\\"tags\\\": [\\n        {\\n            \\\"name\\\": \\\"Spacecrafts\\\"\\n        }\\n    ],\\n    \\\"security\\\": [\\n        {\\n            \\\"ApiKey\\\": []\\n        }\\n    ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"ROOT\"\n    },\n    {\n      \"content\": \"{\\n    \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n    },\\n    \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"id\\\",\\n            \\\"name\\\",\\n            \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"id\\\": {\\n                \\\"$ref\\\": \\\"#/SpacecraftId\\\"\\n            },\\n            \\\"name\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            },\\n            \\\"type\\\": {\\n                \\\"type\\\": \\\"string\\\",\\n                \\\"enum\\\": [\\n                    \\\"capsule\\\",\\n                    \\\"probe\\\",\\n                    \\\"satellite\\\",\\n                    \\\"spaceplane\\\",\\n                    \\\"station\\\"\\n                ]\\n            },\\n            \\\"description\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    },\\n    \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"message\\\": {\\n                \\\"description\\\": \\\"A human readable error message\\\",\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"schemas.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}"

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

```java Create Multi-File Spec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"openapi\\\": \\\"3.0.0\\\",\\n    \\\"servers\\\": [\\n        {\\n            \\\"url\\\": \\\"example.com\\\"\\n        }\\n    ],\\n    \\\"info\\\": {\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Jon\\\"\\n        },\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"title\\\": \\\"Sample API\\\",\\n        \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n    },\\n    \\\"paths\\\": {\\n        \\\"/spacecrafts/{spacecraftId}\\\": {\\n            \\\"parameters\\\": [\\n                {\\n                    \\\"name\\\": \\\"spacecraftId\\\",\\n                    \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n                    \\\"in\\\": \\\"path\\\",\\n                    \\\"required\\\": true,\\n                    \\\"schema\\\": {\\n                        \\\"$ref\\\": \\\"schemas.json#/SpacecraftId\\\"\\n                    }\\n                }\\n            ],\\n            \\\"get\\\": {\\n                \\\"summary\\\": \\\"Read a spacecraft\\\",\\n                \\\"description\\\": \\\"Get information about a spacecraft.\\\",\\n                \\\"operationId\\\": \\\"getSpacecraft\\\",\\n                \\\"tags\\\": [\\n                    \\\"Spacecrafts\\\"\\n                ],\\n                \\\"responses\\\": {\\n                    \\\"200\\\": {\\n                        \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Spacecraft\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"404\\\": {\\n                        \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"500\\\": {\\n                        \\\"description\\\": \\\"Unexpected error\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    }\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"securitySchemes\\\": {\\n            \\\"ApiKey\\\": {\\n                \\\"type\\\": \\\"apiKey\\\",\\n                \\\"in\\\": \\\"header\\\",\\n                \\\"name\\\": \\\"x-api-key\\\"\\n            }\\n        }\\n    },\\n    \\\"tags\\\": [\\n        {\\n            \\\"name\\\": \\\"Spacecrafts\\\"\\n        }\\n    ],\\n    \\\"security\\\": [\\n        {\\n            \\\"ApiKey\\\": []\\n        }\\n    ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"ROOT\"\n    },\n    {\n      \"content\": \"{\\n    \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n    },\\n    \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"id\\\",\\n            \\\"name\\\",\\n            \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"id\\\": {\\n                \\\"$ref\\\": \\\"#/SpacecraftId\\\"\\n            },\\n            \\\"name\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            },\\n            \\\"type\\\": {\\n                \\\"type\\\": \\\"string\\\",\\n                \\\"enum\\\": [\\n                    \\\"capsule\\\",\\n                    \\\"probe\\\",\\n                    \\\"satellite\\\",\\n                    \\\"spaceplane\\\",\\n                    \\\"station\\\"\\n                ]\\n            },\\n            \\\"description\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    },\\n    \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"message\\\": {\\n                \\\"description\\\": \\\"A human readable error message\\\",\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"schemas.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}")
  .asString();
```

```php Create Multi-File Spec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9', [
  'body' => '{
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    {
      "content": "{\\n    \\"openapi\\": \\"3.0.0\\",\\n    \\"servers\\": [\\n        {\\n            \\"url\\": \\"example.com\\"\\n        }\\n    ],\\n    \\"info\\": {\\n        \\"contact\\": {\\n            \\"name\\": \\"Jon\\"\\n        },\\n        \\"version\\": \\"1.0.0\\",\\n        \\"title\\": \\"Sample API\\",\\n        \\"description\\": \\"Buy or rent spacecrafts\\"\\n    },\\n    \\"paths\\": {\\n        \\"/spacecrafts/{spacecraftId}\\": {\\n            \\"parameters\\": [\\n                {\\n                    \\"name\\": \\"spacecraftId\\",\\n                    \\"description\\": \\"The unique identifier of the spacecraft\\",\\n                    \\"in\\": \\"path\\",\\n                    \\"required\\": true,\\n                    \\"schema\\": {\\n                        \\"$ref\\": \\"schemas.json#/SpacecraftId\\"\\n                    }\\n                }\\n            ],\\n            \\"get\\": {\\n                \\"summary\\": \\"Read a spacecraft\\",\\n                \\"description\\": \\"Get information about a spacecraft.\\",\\n                \\"operationId\\": \\"getSpacecraft\\",\\n                \\"tags\\": [\\n                    \\"Spacecrafts\\"\\n                ],\\n                \\"responses\\": {\\n                    \\"200\\": {\\n                        \\"description\\": \\"The spacecraft corresponding to the provided `spacecraftId`\\",\\n                        \\"content\\": {\\n                            \\"application/json\\": {\\n                                \\"schema\\": {\\n                                    \\"$ref\\": \\"schemas.json#/Spacecraft\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\"404\\": {\\n                        \\"description\\": \\"No spacecraft found for the provided `spacecraftId`\\",\\n                        \\"content\\": {\\n                            \\"application/json\\": {\\n                                \\"schema\\": {\\n                                    \\"$ref\\": \\"schemas.json#/Error\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\"500\\": {\\n                        \\"description\\": \\"Unexpected error\\",\\n                        \\"content\\": {\\n                            \\"application/json\\": {\\n                                \\"schema\\": {\\n                                    \\"$ref\\": \\"schemas.json#/Error\\"\\n                                }\\n                            }\\n                        }\\n                    }\\n                }\\n            }\\n        }\\n    },\\n    \\"components\\": {\\n        \\"securitySchemes\\": {\\n            \\"ApiKey\\": {\\n                \\"type\\": \\"apiKey\\",\\n                \\"in\\": \\"header\\",\\n                \\"name\\": \\"x-api-key\\"\\n            }\\n        }\\n    },\\n    \\"tags\\": [\\n        {\\n            \\"name\\": \\"Spacecrafts\\"\\n        }\\n    ],\\n    \\"security\\": [\\n        {\\n            \\"ApiKey\\": []\\n        }\\n    ]\\n}",
      "path": "index.json",
      "type": "ROOT"
    },
    {
      "content": "{\\n    \\"SpacecraftId\\": {\\n        \\"description\\": \\"The unique identifier of a spacecraft\\",\\n        \\"type\\": \\"string\\"\\n    },\\n    \\"Spacecraft\\": {\\n        \\"type\\": \\"object\\",\\n        \\"required\\": [\\n            \\"id\\",\\n            \\"name\\",\\n            \\"type\\"\\n        ],\\n        \\"properties\\": {\\n            \\"id\\": {\\n                \\"$ref\\": \\"#/SpacecraftId\\"\\n            },\\n            \\"name\\": {\\n                \\"type\\": \\"string\\"\\n            },\\n            \\"type\\": {\\n                \\"type\\": \\"string\\",\\n                \\"enum\\": [\\n                    \\"capsule\\",\\n                    \\"probe\\",\\n                    \\"satellite\\",\\n                    \\"spaceplane\\",\\n                    \\"station\\"\\n                ]\\n            },\\n            \\"description\\": {\\n                \\"type\\": \\"string\\"\\n            }\\n        }\\n    },\\n    \\"Error\\": {\\n        \\"type\\": \\"object\\",\\n        \\"required\\": [\\n            \\"message\\"\\n        ],\\n        \\"properties\\": {\\n            \\"message\\": {\\n                \\"description\\": \\"A human readable error message\\",\\n                \\"type\\": \\"string\\"\\n            }\\n        }\\n    }\\n}",
      "path": "schemas.json",
      "type": "DEFAULT"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create Multi-File Spec
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Sample API\",\n  \"type\": \"OPENAPI:3.0\",\n  \"files\": [\n    {\n      \"content\": \"{\\n    \\\"openapi\\\": \\\"3.0.0\\\",\\n    \\\"servers\\\": [\\n        {\\n            \\\"url\\\": \\\"example.com\\\"\\n        }\\n    ],\\n    \\\"info\\\": {\\n        \\\"contact\\\": {\\n            \\\"name\\\": \\\"Jon\\\"\\n        },\\n        \\\"version\\\": \\\"1.0.0\\\",\\n        \\\"title\\\": \\\"Sample API\\\",\\n        \\\"description\\\": \\\"Buy or rent spacecrafts\\\"\\n    },\\n    \\\"paths\\\": {\\n        \\\"/spacecrafts/{spacecraftId}\\\": {\\n            \\\"parameters\\\": [\\n                {\\n                    \\\"name\\\": \\\"spacecraftId\\\",\\n                    \\\"description\\\": \\\"The unique identifier of the spacecraft\\\",\\n                    \\\"in\\\": \\\"path\\\",\\n                    \\\"required\\\": true,\\n                    \\\"schema\\\": {\\n                        \\\"$ref\\\": \\\"schemas.json#/SpacecraftId\\\"\\n                    }\\n                }\\n            ],\\n            \\\"get\\\": {\\n                \\\"summary\\\": \\\"Read a spacecraft\\\",\\n                \\\"description\\\": \\\"Get information about a spacecraft.\\\",\\n                \\\"operationId\\\": \\\"getSpacecraft\\\",\\n                \\\"tags\\\": [\\n                    \\\"Spacecrafts\\\"\\n                ],\\n                \\\"responses\\\": {\\n                    \\\"200\\\": {\\n                        \\\"description\\\": \\\"The spacecraft corresponding to the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Spacecraft\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"404\\\": {\\n                        \\\"description\\\": \\\"No spacecraft found for the provided `spacecraftId`\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    },\\n                    \\\"500\\\": {\\n                        \\\"description\\\": \\\"Unexpected error\\\",\\n                        \\\"content\\\": {\\n                            \\\"application/json\\\": {\\n                                \\\"schema\\\": {\\n                                    \\\"$ref\\\": \\\"schemas.json#/Error\\\"\\n                                }\\n                            }\\n                        }\\n                    }\\n                }\\n            }\\n        }\\n    },\\n    \\\"components\\\": {\\n        \\\"securitySchemes\\\": {\\n            \\\"ApiKey\\\": {\\n                \\\"type\\\": \\\"apiKey\\\",\\n                \\\"in\\\": \\\"header\\\",\\n                \\\"name\\\": \\\"x-api-key\\\"\\n            }\\n        }\\n    },\\n    \\\"tags\\\": [\\n        {\\n            \\\"name\\\": \\\"Spacecrafts\\\"\\n        }\\n    ],\\n    \\\"security\\\": [\\n        {\\n            \\\"ApiKey\\\": []\\n        }\\n    ]\\n}\",\n      \"path\": \"index.json\",\n      \"type\": \"ROOT\"\n    },\n    {\n      \"content\": \"{\\n    \\\"SpacecraftId\\\": {\\n        \\\"description\\\": \\\"The unique identifier of a spacecraft\\\",\\n        \\\"type\\\": \\\"string\\\"\\n    },\\n    \\\"Spacecraft\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"id\\\",\\n            \\\"name\\\",\\n            \\\"type\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"id\\\": {\\n                \\\"$ref\\\": \\\"#/SpacecraftId\\\"\\n            },\\n            \\\"name\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            },\\n            \\\"type\\\": {\\n                \\\"type\\\": \\\"string\\\",\\n                \\\"enum\\\": [\\n                    \\\"capsule\\\",\\n                    \\\"probe\\\",\\n                    \\\"satellite\\\",\\n                    \\\"spaceplane\\\",\\n                    \\\"station\\\"\\n                ]\\n            },\\n            \\\"description\\\": {\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    },\\n    \\\"Error\\\": {\\n        \\\"type\\\": \\\"object\\\",\\n        \\\"required\\\": [\\n            \\\"message\\\"\\n        ],\\n        \\\"properties\\\": {\\n            \\\"message\\\": {\\n                \\\"description\\\": \\\"A human readable error message\\\",\\n                \\\"type\\\": \\\"string\\\"\\n            }\\n        }\\n    }\\n}\",\n      \"path\": \"schemas.json\",\n      \"type\": \"DEFAULT\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Multi-File Spec
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Sample API",
  "type": "OPENAPI:3.0",
  "files": [
    [
      "content": "{
    \"openapi\": \"3.0.0\",
    \"servers\": [
        {
            \"url\": \"example.com\"
        }
    ],
    \"info\": {
        \"contact\": {
            \"name\": \"Jon\"
        },
        \"version\": \"1.0.0\",
        \"title\": \"Sample API\",
        \"description\": \"Buy or rent spacecrafts\"
    },
    \"paths\": {
        \"/spacecrafts/{spacecraftId}\": {
            \"parameters\": [
                {
                    \"name\": \"spacecraftId\",
                    \"description\": \"The unique identifier of the spacecraft\",
                    \"in\": \"path\",
                    \"required\": true,
                    \"schema\": {
                        \"$ref\": \"schemas.json#/SpacecraftId\"
                    }
                }
            ],
            \"get\": {
                \"summary\": \"Read a spacecraft\",
                \"description\": \"Get information about a spacecraft.\",
                \"operationId\": \"getSpacecraft\",
                \"tags\": [
                    \"Spacecrafts\"
                ],
                \"responses\": {
                    \"200\": {
                        \"description\": \"The spacecraft corresponding to the provided `spacecraftId`\",
                        \"content\": {
                            \"application/json\": {
                                \"schema\": {
                                    \"$ref\": \"schemas.json#/Spacecraft\"
                                }
                            }
                        }
                    },
                    \"404\": {
                        \"description\": \"No spacecraft found for the provided `spacecraftId`\",
                        \"content\": {
                            \"application/json\": {
                                \"schema\": {
                                    \"$ref\": \"schemas.json#/Error\"
                                }
                            }
                        }
                    },
                    \"500\": {
                        \"description\": \"Unexpected error\",
                        \"content\": {
                            \"application/json\": {
                                \"schema\": {
                                    \"$ref\": \"schemas.json#/Error\"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    \"components\": {
        \"securitySchemes\": {
            \"ApiKey\": {
                \"type\": \"apiKey\",
                \"in\": \"header\",
                \"name\": \"x-api-key\"
            }
        }
    },
    \"tags\": [
        {
            \"name\": \"Spacecrafts\"
        }
    ],
    \"security\": [
        {
            \"ApiKey\": []
        }
    ]
}",
      "path": "index.json",
      "type": "ROOT"
    ],
    [
      "content": "{
    \"SpacecraftId\": {
        \"description\": \"The unique identifier of a spacecraft\",
        \"type\": \"string\"
    },
    \"Spacecraft\": {
        \"type\": \"object\",
        \"required\": [
            \"id\",
            \"name\",
            \"type\"
        ],
        \"properties\": {
            \"id\": {
                \"$ref\": \"#/SpacecraftId\"
            },
            \"name\": {
                \"type\": \"string\"
            },
            \"type\": {
                \"type\": \"string\",
                \"enum\": [
                    \"capsule\",
                    \"probe\",
                    \"satellite\",
                    \"spaceplane\",
                    \"station\"
                ]
            },
            \"description\": {
                \"type\": \"string\"
            }
        }
    },
    \"Error\": {
        \"type\": \"object\",
        \"required\": [
            \"message\"
        ],
        \"properties\": {
            \"message\": {
                \"description\": \"A human readable error message\",
                \"type\": \"string\"
            }
        }
    }
}",
      "path": "schemas.json",
      "type": "DEFAULT"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs?workspaceId=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9")! 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()
```