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

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

Gets all of your [collections](https://www.postman.com/docs/collections). The response includes all of your subscribed collections.

**Note:**

- It's recommended that you use pagination with this endpoint. Pagination improves endpoint performance. Unpaginated calls are considered deprecated and are subject to change.
- Filtering with the `name` parameter when you also pass the `limit` and `offset` parameters is not supported.
- If you pass an invalid workspace ID for the `workspace` query parameter, this endpoint returns an HTTP `200 OK` response with an empty array.


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

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

### Query parameters

- `workspace` (string, optional) — The workspace's ID.
- `name` (string, optional) — Filter results by collections whose name exactly matches the given value. Partial or substring matches are not supported.
- `limit` (integer, optional) — The maximum number of rows to return in the response.
- `offset` (integer, optional) — The zero-based offset of the first item to return.

## Response

### 200

Successful Response

- `collections` (list of object, optional)
  - `id` (string, optional) — The collection's ID.
  - `name` (string, optional) — The collection's name.
  - `owner` (string, optional) — The owner of the collection.
  - `createdAt` (datetime, optional) — The collection's creation date and time.
  - `updatedAt` (datetime, optional) — The date and time at which the collection was last updated.
  - `uid` (string, optional) — The collection's unique ID.
  - `fork` (object, optional) — If the collection is [forked](https://learning.postman.com/docs/collaborating-in-postman/version-control/#forking-postman-entities), the fork's information.
    - `label` (string, optional) — The fork's label.
    - `createdAt` (datetime, optional) — The fork's creation date and time.
    - `from` (string, optional) — The unique ID of the fork's source collection.
  - `isPublic` (boolean, optional) — If true, the collection is public and visible to all users.
- `meta` (object, optional) — The response's meta information for paginated results.
  - `total` (double, optional) — The number of records found.
  - `offset` (double, optional) — The zero-based offset of the first item returned.
  - `limit` (double, optional) — The maximum number of records in the paginated response.

## Examples

### Successful Response

**Response**

```json
{
  "collections": [
    {
      "id": "026fa484-c108-4223-af5e-e97137865143",
      "name": "Test API 3.1.0",
      "owner": "892436",
      "createdAt": "2024-09-09T14:16:40.000Z",
      "updatedAt": "2024-09-09T14:16:40.000Z",
      "uid": "892436-026fa484-c108-4223-af5e-e97137865143",
      "isPublic": false
    },
    {
      "id": "02c5343c-0a8d-4bd9-941c-cd9dadd73770",
      "name": "Sanity tests collection changed all values",
      "owner": "892436",
      "createdAt": "2024-03-01T23:01:22.000Z",
      "updatedAt": "2024-03-01T23:01:32.000Z",
      "uid": "892436-02c5343c-0a8d-4bd9-941c-cd9dadd73770",
      "isPublic": false
    },
    {
      "id": "044f35b0-dffe-4ce6-9114-165c720657de",
      "name": "Sanity tests collection",
      "owner": "892436",
      "createdAt": "2023-08-21T15:06:57.000Z",
      "updatedAt": "2023-08-21T15:06:57.000Z",
      "uid": "892436-044f35b0-dffe-4ce6-9114-165c720657de",
      "isPublic": false
    }
  ],
  "meta": {
    "total": 192,
    "offset": 0,
    "limit": 3
  }
}
```

**SDK Code**

```python Successful Response
import requests

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

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

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

print(response.json())
```

```javascript Successful Response
const url = 'https://api.postman.com/collections';
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/collections"

	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/collections")

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/collections")
  .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/collections', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.postman.com/collections");
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/collections")! 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()
```

### Invalid Workspace

**Response**

```json
{
  "collections": []
}
```

**SDK Code**

```python Invalid Workspace
import requests

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

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

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

print(response.json())
```

```javascript Invalid Workspace
const url = 'https://api.postman.com/collections';
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 Invalid Workspace
package main

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

func main() {

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

	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 Invalid Workspace
require 'uri'
require 'net/http'

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

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 Invalid Workspace
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.postman.com/collections")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Invalid Workspace
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.postman.com/collections', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Invalid Workspace
using RestSharp;

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

```swift Invalid Workspace
import Foundation

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

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