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

POST https://api.getpostman.com/specs/{specId}/files
Content-Type: application/json

Creates a file for an OpenAPI or a protobuf 2 or 3 specification.

**Note:**

- 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.
- Creating a spec file assigns it the `DEFAULT` file type.
- Multi-file specifications can only have one root file.
- Files cannot exceed a maximum of 10 MB in size.


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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /specs/{specId}/files:
    post:
      operationId: createSpecFile
      summary: Create a spec file
      description: >
        Creates a file for an OpenAPI or a protobuf 2 or 3 specification.


        **Note:**


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

        - Creating a spec file assigns it the `DEFAULT` file type.

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

        - Files cannot exceed a maximum of 10 MB in size.
      tags:
        - specs
      parameters:
        - name: specId
          in: path
          description: The spec's ID.
          required: true
          schema:
            $ref: '#/components/schemas/specId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createUpdateSpecFileResponse'
        '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/CreateSpecFileRequestForbiddenError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSpecFileRequestInternalServerError'
      requestBody:
        description: Create Spec File
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createSpecFile'
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:
    specId:
      type: string
      title: specId
    createSpecFile:
      type: object
      properties:
        path:
          type: string
          description: The file's path. Accepts JSON or YAML files.
        content:
          type: string
          description: The file's stringified contents.
      required:
        - path
        - content
      title: createSpecFile
    CreateUpdateSpecFileResponseType:
      type: string
      enum:
        - DEFAULT
        - ROOT
      default: DEFAULT
      description: >
        The type of file:

        - `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: CreateUpdateSpecFileResponseType
    createUpdateSpecFileResponse:
      type: object
      properties:
        createdAt:
          type: string
          format: date-time
          description: The date and time at which the file was created.
        createdBy:
          type: integer
          description: The user ID of the user that created the file.
        id:
          type: string
          description: The file's ID.
        path:
          type: string
          description: The file's path.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the file was updated.
        updatedBy:
          type: integer
          description: The ID of the user who updated the file.
        type:
          $ref: '#/components/schemas/CreateUpdateSpecFileResponseType'
          default: DEFAULT
          description: >
            The type of file:

            - `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.
      description: Information about the API specification file.
      title: createUpdateSpecFileResponse
    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
    CreateSpecFileRequestForbiddenError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
      title: CreateSpecFileRequestForbiddenError
    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
    CreateSpecFileRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: CreateSpecFileRequestInternalServerError
  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

### JSON Spec File



**Request**

```json
undefined
```

**Response**

```json
{
  "createdAt": "2025-07-22T19:29:08.000Z",
  "createdBy": 12345678,
  "id": "2fdc8ea1-d02e-4e50-989e-6fa28f42b995",
  "path": "schemas.json",
  "updatedAt": "2025-07-22T19:29:57.000Z",
  "updatedBy": 12345678,
  "type": "ROOT"
}
```

**SDK Code**

```python JSON Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

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

print(response.json())
```

```javascript JSON Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
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 JSON Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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 JSON Spec File
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp JSON Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift JSON Spec File
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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()
```

### YAML Spec File



**Request**

```json
undefined
```

**Response**

```json
{
  "createdAt": "2025-07-22T19:29:08.000Z",
  "createdBy": 12345678,
  "id": "2fdc8ea1-d02e-4e50-989e-6fa28f42b995",
  "path": "schemas.yaml",
  "updatedAt": "2025-07-22T19:29:57.000Z",
  "updatedBy": 12345678,
  "type": "ROOT"
}
```

**SDK Code**

```python YAML Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

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

print(response.json())
```

```javascript YAML Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
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 YAML Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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 YAML Spec File
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp YAML Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift YAML Spec File
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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()
```

### Protobuf Spec File



**Request**

```json
undefined
```

**Response**

```json
{
  "createdAt": "2026-04-14T17:44:29.389Z",
  "createdBy": 12345678,
  "id": "799c482f-ffe6-4399-a919-b3cf6a3da888",
  "path": "file.proto",
  "updatedAt": "2026-04-14T17:44:29.389Z",
  "updatedBy": 12345678,
  "type": "DEFAULT"
}
```

**SDK Code**

```python Protobuf Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

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

print(response.json())
```

```javascript Protobuf Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
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 Protobuf Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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 Protobuf Spec File
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Protobuf Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Protobuf Spec File
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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()
```

### Nested Spec File



**Request**

```json
undefined
```

**Response**

```json
{
  "createdAt": "2025-07-22T19:29:08.000Z",
  "createdBy": 12345678,
  "id": "e8a015e0-f472-4bb3-a523-57ce7c4583ed",
  "path": "components/schemas/spacecrafts.json",
  "updatedAt": "2025-07-22T19:29:57.000Z",
  "updatedBy": 12345678,
  "type": "DEFAULT"
}
```

**SDK Code**

```python Nested Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

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

print(response.json())
```

```javascript Nested Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
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 Nested Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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 Nested Spec File
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Nested Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Nested Spec File
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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 JSON Spec File



**Request**

```json
{
  "path": "schemas.json",
  "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}"
}
```

**Response**

```json
{
  "createdAt": "2025-07-22T19:29:08.000Z",
  "createdBy": 12345678,
  "id": "2fdc8ea1-d02e-4e50-989e-6fa28f42b995",
  "path": "schemas.json",
  "updatedAt": "2025-07-22T19:29:57.000Z",
  "updatedBy": 12345678,
  "type": "ROOT"
}
```

**SDK Code**

```python Create JSON Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

payload = {
    "path": "schemas.json",
    "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\"
            }
        }
    }
}"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create JSON Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"path":"schemas.json","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}"}'
};

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

```go Create JSON Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

	payload := strings.NewReader("{\n  \"path\": \"schemas.json\",\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}")

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

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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  \"path\": \"schemas.json\",\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}"

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

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

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"path\": \"schemas.json\",\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}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'body' => '{
  "path": "schemas.json",
  "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}"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create JSON Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"path\": \"schemas.json\",\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}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create JSON Spec File
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "path": "schemas.json",
  "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\"
            }
        }
    }
}"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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 YAML Spec File



**Request**

```json
{
  "path": "schemas.yaml",
  "content": "SpacecraftId:\n  description: The unique identifier of a spacecraft\n  type: string\nSpacecraft:\n  type: object\n  required:\n  - id\n  - name\n  - type\n  properties:\n    id:\n      \"$ref\": \"#/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\nError:\n  type: object\n  required:\n  - message\n  properties:\n    message:\n      description: A human readable error message\n      type: string\n"
}
```

**Response**

```json
{
  "createdAt": "2025-07-22T19:29:08.000Z",
  "createdBy": 12345678,
  "id": "2fdc8ea1-d02e-4e50-989e-6fa28f42b995",
  "path": "schemas.json",
  "updatedAt": "2025-07-22T19:29:57.000Z",
  "updatedBy": 12345678,
  "type": "ROOT"
}
```

**SDK Code**

```python Create YAML Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

payload = {
    "path": "schemas.yaml",
    "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
"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create YAML Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"path":"schemas.yaml","content":"SpacecraftId:\n  description: The unique identifier of a spacecraft\n  type: string\nSpacecraft:\n  type: object\n  required:\n  - id\n  - name\n  - type\n  properties:\n    id:\n      \"$ref\": \"#/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\nError:\n  type: object\n  required:\n  - message\n  properties:\n    message:\n      description: A human readable error message\n      type: string\n"}'
};

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

```go Create YAML Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

	payload := strings.NewReader("{\n  \"path\": \"schemas.yaml\",\n  \"content\": \"SpacecraftId:\\n  description: The unique identifier of a spacecraft\\n  type: string\\nSpacecraft:\\n  type: object\\n  required:\\n  - id\\n  - name\\n  - type\\n  properties:\\n    id:\\n      \\\"$ref\\\": \\\"#/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\\nError:\\n  type: object\\n  required:\\n  - message\\n  properties:\\n    message:\\n      description: A human readable error message\\n      type: string\\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 YAML Spec File
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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  \"path\": \"schemas.yaml\",\n  \"content\": \"SpacecraftId:\\n  description: The unique identifier of a spacecraft\\n  type: string\\nSpacecraft:\\n  type: object\\n  required:\\n  - id\\n  - name\\n  - type\\n  properties:\\n    id:\\n      \\\"$ref\\\": \\\"#/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\\nError:\\n  type: object\\n  required:\\n  - message\\n  properties:\\n    message:\\n      description: A human readable error message\\n      type: string\\n\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"path\": \"schemas.yaml\",\n  \"content\": \"SpacecraftId:\\n  description: The unique identifier of a spacecraft\\n  type: string\\nSpacecraft:\\n  type: object\\n  required:\\n  - id\\n  - name\\n  - type\\n  properties:\\n    id:\\n      \\\"$ref\\\": \\\"#/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\\nError:\\n  type: object\\n  required:\\n  - message\\n  properties:\\n    message:\\n      description: A human readable error message\\n      type: string\\n\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'body' => '{
  "path": "schemas.yaml",
  "content": "SpacecraftId:\\n  description: The unique identifier of a spacecraft\\n  type: string\\nSpacecraft:\\n  type: object\\n  required:\\n  - id\\n  - name\\n  - type\\n  properties:\\n    id:\\n      \\"$ref\\": \\"#/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\\nError:\\n  type: object\\n  required:\\n  - message\\n  properties:\\n    message:\\n      description: A human readable error message\\n      type: string\\n"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create YAML Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"path\": \"schemas.yaml\",\n  \"content\": \"SpacecraftId:\\n  description: The unique identifier of a spacecraft\\n  type: string\\nSpacecraft:\\n  type: object\\n  required:\\n  - id\\n  - name\\n  - type\\n  properties:\\n    id:\\n      \\\"$ref\\\": \\\"#/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\\nError:\\n  type: object\\n  required:\\n  - message\\n  properties:\\n    message:\\n      description: A human readable error message\\n      type: string\\n\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create YAML Spec File
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "path": "schemas.yaml",
  "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
"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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 Protobuf Spec File



**Request**

```json
{
  "path": "file.proto",
  "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"
}
```

**Response**

```json
{
  "createdAt": "2025-07-22T19:29:08.000Z",
  "createdBy": 12345678,
  "id": "2fdc8ea1-d02e-4e50-989e-6fa28f42b995",
  "path": "schemas.json",
  "updatedAt": "2025-07-22T19:29:57.000Z",
  "updatedBy": 12345678,
  "type": "ROOT"
}
```

**SDK Code**

```python Create Protobuf Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

payload = {
    "path": "file.proto",
    "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) {}
}
"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create Protobuf Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"path":"file.proto","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"}'
};

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

```go Create Protobuf Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

	payload := strings.NewReader("{\n  \"path\": \"file.proto\",\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\"\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 Protobuf Spec File
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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  \"path\": \"file.proto\",\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\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"path\": \"file.proto\",\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\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'body' => '{
  "path": "file.proto",
  "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"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create Protobuf Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"path\": \"file.proto\",\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\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Protobuf Spec File
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "path": "file.proto",
  "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) {}
}
"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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 Nested Spec File



**Request**

```json
{
  "path": "components/schemas/spacecrafts.json",
  "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\": \"../schemas/spacecrafts.json#/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}"
}
```

**Response**

```json
{
  "createdAt": "2025-07-22T19:29:08.000Z",
  "createdBy": 12345678,
  "id": "2fdc8ea1-d02e-4e50-989e-6fa28f42b995",
  "path": "schemas.json",
  "updatedAt": "2025-07-22T19:29:57.000Z",
  "updatedBy": 12345678,
  "type": "ROOT"
}
```

**SDK Code**

```python Create a Nested Spec File
import requests

url = "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

payload = {
    "path": "components/schemas/spacecrafts.json",
    "content": "{
  \"SpacecraftId\": {
    \"description\": \"The unique identifier of a spacecraft\",
    \"type\": \"string\"
  },
  \"Spacecraft\": {
    \"type\": \"object\",
    \"required\": [
      \"id\",
      \"name\",
      \"type\"
    ],
    \"properties\": {
      \"id\": {
        \"$ref\": \"../schemas/spacecrafts.json#/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\"
      }
    }
  }
}"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a Nested Spec File
const url = 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"path":"components/schemas/spacecrafts.json","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\": \"../schemas/spacecrafts.json#/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}"}'
};

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

```go Create a Nested Spec File
package main

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

func main() {

	url := "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

	payload := strings.NewReader("{\n  \"path\": \"components/schemas/spacecrafts.json\",\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\\\": \\\"../schemas/spacecrafts.json#/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}")

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

url = URI("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")

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  \"path\": \"components/schemas/spacecrafts.json\",\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\\\": \\\"../schemas/spacecrafts.json#/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}"

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

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

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"path\": \"components/schemas/spacecrafts.json\",\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\\\": \\\"../schemas/spacecrafts.json#/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}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files', [
  'body' => '{
  "path": "components/schemas/spacecrafts.json",
  "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\\": \\"../schemas/spacecrafts.json#/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}"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create a Nested Spec File
using RestSharp;

var client = new RestClient("https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"path\": \"components/schemas/spacecrafts.json\",\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\\\": \\\"../schemas/spacecrafts.json#/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}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a Nested Spec File
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "path": "components/schemas/spacecrafts.json",
  "content": "{
  \"SpacecraftId\": {
    \"description\": \"The unique identifier of a spacecraft\",
    \"type\": \"string\"
  },
  \"Spacecraft\": {
    \"type\": \"object\",
    \"required\": [
      \"id\",
      \"name\",
      \"type\"
    ],
    \"properties\": {
      \"id\": {
        \"$ref\": \"../schemas/spacecrafts.json#/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\"
      }
    }
  }
}"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")! 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()
```