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

# Get all components

GET https://api.postman.com/components

Gets a list of all components in the team's component library.

Reference: https://learning.postman.com/api-docs/api-reference/components/get-all-components

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

### Query parameters

- `type` (enum, optional) — Filter results by component type.
  - Allowed values: `OAS2`, `OAS3`, `OAS3_1`
- `status` (enum, optional) — Filter results by the component's status.
  - Allowed values: `active`, `archive`
- `hasVersions` (boolean, optional) — If true, return only components with published versions.
- `include` (string, optional) — A comma-separated list of additional fields to include. Accepts the `hasVersions`, `latestVersion`, `latestVersion.content` values.
- `expand` (string, optional) — A comma-separated list of fields to expand. Accepts the `latestVersion` value.

## Response

### 200

Successful Response

- `meta` (meta, optional) — The response's meta information for paginated results.
- `data` (list of componentData, optional) — A list of components.

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

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

### 500 Internal Server Error

Internal Server Error

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

## Types

### meta

The response's meta information for paginated results.

- `nextCursor` (string, optional, nullable) — The pagination cursor that points to the next record in the results set.

### componentData

Information about the component.

- `id` (string, optional) — The component's ID.
- `name` (string, optional) — The component's name.
- `type` (enum, optional) — The component's type. Corresponds to the specification that the component's content adheres to.
  - Allowed values: `OAS2`, `OAS3`, `OAS3_1`
- `status` (enum, optional) — The component's lifecycle state: - `active` — The component is active and can be edited and published. - `archive` — The component is archived and read-only. Archived components can't be edited or published, but their existing versions remain accessible.
  - Allowed values: `active`, `archive`
- `createdAt` (datetime, optional) — The date and time at which the component was created.
- `updatedAt` (datetime, optional) — The date and time at which the component was last updated.
- `createdBy` (string, optional) — The ID of the user who created the component.
- `updatedBy` (string, optional) — The ID of the user who last updated the component.
- `hasVersions` (boolean, optional) — Whether the component has versions. Returns only when you pass the `hasVersions` value for the `include` parameter.
- `latestVersion` (ComponentDataLatestVersion, optional) — Information about the component's latest version. This property only returns only when you pass the `latestVersion` value for the `include` parameter. To return detailed information about the component's latest version, pass the `latestVersion` value for the `expand` parameter.

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

### commonErrorNameMessage

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

### commonErrorTypeTitleDetail

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

### ComponentDataLatestVersion

Information about the component's latest version. This property only returns only when you pass the `latestVersion` value for the `include` parameter. To return detailed information about the component's latest version, pass the `latestVersion` value for the `expand` parameter.

- string
- Component Version Data: componentVersionData

### CommonErrorNameMessageError

Information about the error.

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

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

### componentVersionData

Information about a component's version.

- `id` (string, optional) — The component version's ID.
- `label` (string, optional) — The component version's label.
- `url` (string, optional) — The URL where the component version can be accessed.
- `format` (string, optional) — The component version's content format.
- `publishedAt` (datetime, optional) — The date and time at which the component version was published.
- `content` (string, optional) — The version's content. This returns when you include the `include` parameter.

## Examples

### Successful Response

**Response**

```json
{
  "data": [
    {
      "id": "01KT964C30J3DPJQKEACZH39N8",
      "name": "example-component",
      "type": "OAS3",
      "status": "active",
      "createdAt": "2026-01-15T10:30:00.000Z",
      "updatedAt": "2026-01-15T10:30:00.000Z",
      "createdBy": "12345678",
      "updatedBy": "12345678"
    },
    {
      "id": "01KT964C30J3DPJQKEACZH39N9",
      "name": "another-component",
      "type": "OAS2",
      "status": "active",
      "createdAt": "2026-01-14T09:20:00.000Z",
      "updatedAt": "2026-01-14T09:20:00.000Z",
      "createdBy": "12345678",
      "updatedBy": "12345678"
    }
  ]
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.postman.com/components"

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

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

print(response.json())
```

```javascript Successful Response
const url = 'https://api.postman.com/components';
const options = {method: 'GET', 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 Successful Response
package main

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

func main() {

	url := "https://api.postman.com/components"

	req, _ := http.NewRequest("GET", 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 Successful Response
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/components")

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

request = Net::HTTP::Get.new(url)
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/components")
  .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/components', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.postman.com/components");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Successful Response
import Foundation

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

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

### Filter Results by include

**Response**

```json
{
  "data": [
    {
      "id": "01KT964C30J3DPJQKEACZH39N8",
      "name": "example-component",
      "type": "OAS3",
      "status": "active",
      "createdAt": "2026-01-15T10:30:00.000Z",
      "updatedAt": "2026-01-15T10:30:00.000Z",
      "createdBy": "12345678",
      "updatedBy": "12345678",
      "hasVersions": true
    },
    {
      "id": "01KT964C30J3DPJQKEACZH39N9",
      "name": "another-component",
      "type": "OAS2",
      "status": "active",
      "createdAt": "2026-01-14T09:20:00.000Z",
      "updatedAt": "2026-01-14T09:20:00.000Z",
      "createdBy": "12345678",
      "updatedBy": "12345678",
      "hasVersions": false
    }
  ]
}
```

**SDK Code**

```python Filter Results by include
import requests

url = "https://api.postman.com/components"

querystring = {"include":"hasVersions,latestVersion"}

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

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

print(response.json())
```

```javascript Filter Results by include
const url = 'https://api.postman.com/components?include=hasVersions%2ClatestVersion';
const options = {method: 'GET', 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 Filter Results by include
package main

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

func main() {

	url := "https://api.postman.com/components?include=hasVersions%2ClatestVersion"

	req, _ := http.NewRequest("GET", 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 Filter Results by include
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/components?include=hasVersions%2ClatestVersion")

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

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

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

```java Filter Results by include
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.postman.com/components?include=hasVersions%2ClatestVersion")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Filter Results by include
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.postman.com/components?include=hasVersions%2ClatestVersion', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Filter Results by include
using RestSharp;

var client = new RestClient("https://api.postman.com/components?include=hasVersions%2ClatestVersion");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Filter Results by include
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/components?include=hasVersions%2ClatestVersion")! 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()
```

### Filter Results with include and expand

**Response**

```json
{
  "data": [
    {
      "id": "01KT964C30J3DPJQKEACZH39N8",
      "name": "example-component",
      "type": "OAS3",
      "status": "active",
      "createdAt": "2026-01-15T10:30:00.000Z",
      "updatedAt": "2026-01-15T10:30:00.000Z",
      "createdBy": "12345678",
      "updatedBy": "12345678",
      "latestVersion": {
        "content": "components:\n  schemas:\n    sampleUser:\n      description: A sample user object\n      type: object\n      properties:\n        id:\n          type: string\n        name:\n          type: string\n        email:\n          type: string\n      required:\n        - id\n        - name\n        - email\n  responses:\n    sampleError:\n      description: A sample error response\n      content:\n        application/json:\n          schema:\n              type: object\n              properties:\n                  code:\n                    type: string\n                  message:\n                    type: string\n              required:\n                 - code\n                 - message\n  parameters:\n    sampleParam:\n      name: limit\n      in: query\n      description: A sample query parameter\n      schema:\n        type: integer\n        minimum: 1\n        maximum: 100\n        default: 10\n",
        "format": "YAML",
        "id": "01KTK2XSBAA9JHA4KZ4AYTM9VS",
        "label": "v1.0.0",
        "publishedAt": "2026-06-08T07:42:31.000Z",
        "url": "https://components.postman.com/example/Test1/1.0.0"
      }
    },
    {
      "id": "01KT964C30J3DPJQKEACZH39N9",
      "name": "another-component",
      "type": "OAS2",
      "status": "active",
      "createdAt": "2026-01-14T09:20:00.000Z",
      "updatedAt": "2026-01-14T09:20:00.000Z",
      "createdBy": "12345678",
      "updatedBy": "12345678"
    }
  ]
}
```

**SDK Code**

```python Filter Results with include and expand
import requests

url = "https://api.postman.com/components"

querystring = {"expand":"latestVersion","include":"latestVersion,latestVersion.content"}

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

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

print(response.json())
```

```javascript Filter Results with include and expand
const url = 'https://api.postman.com/components?expand=latestVersion&include=latestVersion%2ClatestVersion.content';
const options = {method: 'GET', 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 Filter Results with include and expand
package main

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

func main() {

	url := "https://api.postman.com/components?expand=latestVersion&include=latestVersion%2ClatestVersion.content"

	req, _ := http.NewRequest("GET", 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 Filter Results with include and expand
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/components?expand=latestVersion&include=latestVersion%2ClatestVersion.content")

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

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

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

```java Filter Results with include and expand
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.postman.com/components?expand=latestVersion&include=latestVersion%2ClatestVersion.content")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Filter Results with include and expand
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.postman.com/components?expand=latestVersion&include=latestVersion%2ClatestVersion.content', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Filter Results with include and expand
using RestSharp;

var client = new RestClient("https://api.postman.com/components?expand=latestVersion&include=latestVersion%2ClatestVersion.content");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Filter Results with include and expand
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/components?expand=latestVersion&include=latestVersion%2ClatestVersion.content")! 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()
```