> This page is for Postman API Docs.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Create a spec file

POST https://api.postman.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

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.postman.com` (https://api.postman.com, default)
- `https://api.eu.postman.com` (https://api.eu.postman.com)

## Request

### Path parameters

- `specId` (string, required) — The spec's ID.

### Body (application/json)

This endpoint expects a createSpecFile.

- `path` (string, required) — The file's path. Accepts JSON or YAML files.
- `content` (string, required) — The file's stringified contents.

## Response

### 201

Successful Response

- `createdAt` (datetime, optional) — The date and time at which the file was created.
- `createdBy` (integer, optional) — The user ID of the user that created the file.
- `id` (string, optional) — The file's ID.
- `path` (string, optional) — The file's path.
- `updatedAt` (datetime, optional) — The date and time at which the file was updated.
- `updatedBy` (integer, optional) — The ID of the user who updated the file.
- `type` (enum, optional, default: DEFAULT) — 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.
  - Allowed values: `DEFAULT`, `ROOT`

## Errors

### 400 Bad Request Error

Bad Request

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### 401 Unauthorized Error

Unauthorized

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### 403 Forbidden Error

Forbidden

- `CreateSpecFileRequestForbiddenError`
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Type, Title, Detail, Status, Instance): commonErrorTypeTitleDetailStatusInstance

### 404 Not Found Error

Not Found

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### 500 Internal Server Error

Internal Server Error

- `CreateSpecFileRequestInternalServerError`
  - Error (Type, Title, Detail): commonErrorTypeTitleDetail
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

## Types

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### commonErrorTypeTitleDetailStatus

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### commonErrorTypeTitleDetailStatusInstance

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### commonErrorTypeTitleDetail

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### commonErrorNameMessage

- `error` (CommonErrorNameMessageError, optional) — Information about the error.

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

### CommonErrorNameMessageError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.

## Examples

### JSON Spec File

**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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript JSON Spec File
const url = 'https://api.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp JSON Spec File
using RestSharp;

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

```swift JSON Spec File
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.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

**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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript YAML Spec File
const url = 'https://api.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp YAML Spec File
using RestSharp;

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

```swift YAML Spec File
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.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

**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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript Protobuf Spec File
const url = 'https://api.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Protobuf Spec File
using RestSharp;

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

```swift Protobuf Spec File
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.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

**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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript Nested Spec File
const url = 'https://api.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files"

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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.postman.com/specs/73e15000-bc7a-4802-b80e-05fff18fd7f8/files")
  .header("x-api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Nested Spec File
using RestSharp;

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

```swift Nested Spec File
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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()
```