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

# Get a schema

GET https://api.postman.com/apis/{apiId}/schemas/{schemaId}

Gets information about API schema. You can use the `versionId` query parameter to get a schema published in an API version.

You can use this API to do the following:

- Get a schema's metadata.
- Get all the files in a schema. This only returns the first file in the schema. The endpoint response contains a link to the next set of response results.
- Get a schema's contents in multi-file or bundled format.

**Note:**

The `versionId` query parameter is a required parameter for API viewers.


Reference: https://learning.postman.com/api-docs/api-reference/ap-is/get-api-schema

## Authentication

- `x-api-key` header (required)

## Servers

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

## Request

### Path parameters

- `apiId` (string, required) — The API's ID.
- `schemaId` (string, required) — The API schema's ID.

### Query parameters

- `versionId` (string, optional) — The API's version ID. This is a required parameter for API viewers.
- `bundled` (boolean, optional, default: false) — If true, return the schema in a bundled format.

### Headers

- `Accept` (enum, required) — The `application/vnd.api.v10+json` request header required to use the endpoint.
  - Allowed values: `application/vnd.api.v10+json`

## Response

### 200

Successful Response

- `object or object`
  - Get Schema
    - `id` (string, optional) — The schema's ID.
    - `type` (string, optional) — The schema's type.
    - `files` (object, optional) — Information about the schema's files. The response is paginated and limited to one page.
      - `data` (list of object, optional) — A list of the schema files.
        - `id` (string, optional) — The schema file's ID.
        - `name` (string, optional) — The schema file's name.
        - `path` (string, optional) — The file system path to the schema file.
        - `createdAt` (datetime, optional) — The date and time at which the file was created.
        - `createdBy` (string, optional) — The user ID of the user that created the file.
        - `updatedAt` (datetime, optional) — The date and time at which the file was last updated.
        - `updatedBy` (string, optional) — The user ID of the user that last updated the file.
      - `meta` (object, optional) — The response's non-standard meta information.
        - `nextPath` (string, optional) — The URL path to the next file.
    - `createdAt` (datetime, optional) — The date and time at which the schema was created.
    - `createdBy` (string, optional) — The user ID of the user that created the schema.
    - `updatedAt` (datetime, optional) — The date and time at which the schema was last updated.
    - `updatedBy` (string, optional) — The user ID of the user that last updated the schema.
  - Get Bundled Schema
    - `id` (string, optional) — The schema's ID.
    - `type` (string, optional) — The schema's type.
    - `createdBy` (string, optional) — The user ID of the user that created the schema.
    - `updatedBy` (string, optional) — The user ID of the user that last updated the schema.
    - `createdAt` (datetime, optional) — The date and time at which the schema was created.
    - `updatedAt` (datetime, optional) — The date and time at which the schema was last updated.
    - `content` (string, optional) — The schema file, in a bundled format.

## Examples

**Response**

```json
{
  "createdAt": "2022-03-29T11:37:15Z",
  "files": {
    "data": [
      {
        "createdAt": "2023-03-16T18:38:56.000Z",
        "createdBy": "12345678",
        "id": "cf98c187-17c1-455f-afbf-d4be51f12770",
        "name": "s1.json",
        "path": "dir/s1.json",
        "updatedAt": "2023-03-16T19:11:24.000Z",
        "updatedBy": "12345678"
      }
    ],
    "meta": {
      "nextPath": "/apis/1fdbff7c-036b-4f8a-91bc-17bf3ae74fd2/schemas/cf98c187-17c1-455f-afbf-d4be51f12770/files?cursor=eyJzY2hlbWUiOiJwYXRoX2FzYyIsImRpcmVjdGlvblR5cGUiOiJuZXh0IiwicGl2b3QiOiJwYXRoIiwidmFsdWUiOiJkaXIvczEuanNvbiJ9"
    }
  },
  "updatedAt": "2022-03-29T11:37:15Z"
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/schemas/5381f010-c4c1-11ed-afa1-0242ac120002"

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

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

print(response.json())
```

```javascript Successful Response
const url = 'https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/schemas/5381f010-c4c1-11ed-afa1-0242ac120002';
const options = {
  method: 'GET',
  headers: {Accept: 'application/vnd.api.v10+json', '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 Successful Response
package main

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

func main() {

	url := "https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/schemas/5381f010-c4c1-11ed-afa1-0242ac120002"

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

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

url = URI("https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/schemas/5381f010-c4c1-11ed-afa1-0242ac120002")

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

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

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

```java Successful Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/schemas/5381f010-c4c1-11ed-afa1-0242ac120002")
  .header("Accept", "application/vnd.api.v10+json")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Successful Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/schemas/5381f010-c4c1-11ed-afa1-0242ac120002', [
  'headers' => [
    'Accept' => 'application/vnd.api.v10+json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Successful Response
using RestSharp;

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

```swift Successful Response
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/schemas/5381f010-c4c1-11ed-afa1-0242ac120002")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```