> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Get all collections

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

Gets all of your [collections](https://www.getpostman.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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /collections:
    get:
      operationId: getCollections
      summary: Get all collections
      description: >
        Gets all of your
        [collections](https://www.getpostman.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.
      tags:
        - collections
      parameters:
        - name: workspace
          in: query
          description: The workspace's ID.
          required: false
          schema:
            $ref: '#/components/schemas/workspaceId'
        - name: name
          in: query
          description: >-
            Filter results by collections whose name exactly matches the given
            value. Partial or substring matches are not supported.
          required: false
          schema:
            $ref: '#/components/schemas/collectionNameQuery'
        - name: limit
          in: query
          description: The maximum number of rows to return in the response.
          required: false
          schema:
            $ref: '#/components/schemas/limitNoDefault'
        - name: offset
          in: query
          description: The zero-based offset of the first item to return.
          required: false
          schema:
            $ref: '#/components/schemas/offsetNoDefault'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getCollections'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCollectionsRequestUnauthorizedError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCollectionsRequestInternalServerError'
servers:
  - url: https://api.getpostman.com
    description: https://api.getpostman.com
  - url: https://api.eu.postman.com
    description: https://api.eu.postman.com
components:
  schemas:
    workspaceId:
      type: string
      title: workspaceId
    collectionNameQuery:
      type: string
      title: collectionNameQuery
    limitNoDefault:
      type: integer
      title: limitNoDefault
    offsetNoDefault:
      type: integer
      title: offsetNoDefault
    GetCollectionsCollectionsItemsFork:
      type: object
      properties:
        label:
          type: string
          description: The fork's label.
        createdAt:
          type: string
          format: date-time
          description: The fork's creation date and time.
        from:
          type: string
          description: The unique ID of the fork's source collection.
      description: >-
        If the collection is
        [forked](https://learning.postman.com/docs/collaborating-in-postman/version-control/#forking-postman-entities),
        the fork's information.
      title: GetCollectionsCollectionsItemsFork
    GetCollectionsCollectionsItems:
      type: object
      properties:
        id:
          type: string
          description: The collection's ID.
        name:
          type: string
          description: The collection's name.
        owner:
          type: string
          description: The owner of the collection.
        createdAt:
          type: string
          format: date-time
          description: The collection's creation date and time.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the collection was last updated.
        uid:
          type: string
          format: uid
          description: The collection's unique ID.
        fork:
          $ref: '#/components/schemas/GetCollectionsCollectionsItemsFork'
          description: >-
            If the collection is
            [forked](https://learning.postman.com/docs/collaborating-in-postman/version-control/#forking-postman-entities),
            the fork's information.
        isPublic:
          type: boolean
          description: If true, the collection is public and visible to all users.
      description: Information about the collection.
      title: GetCollectionsCollectionsItems
    metaLimitOffsetTotal:
      type: object
      properties:
        total:
          type: number
          format: double
          description: The number of records found.
        offset:
          type: number
          format: double
          description: The zero-based offset of the first item returned.
        limit:
          type: number
          format: double
          description: The maximum number of records in the paginated response.
      description: The response's meta information for paginated results.
      title: metaLimitOffsetTotal
    getCollections:
      type: object
      properties:
        collections:
          type: array
          items:
            $ref: '#/components/schemas/GetCollectionsCollectionsItems'
        meta:
          $ref: '#/components/schemas/metaLimitOffsetTotal'
      title: getCollections
    CommonErrorTypeTitleDetailStatusType:
      oneOf:
        - type: string
          format: uri-reference
        - type: string
      title: CommonErrorTypeTitleDetailStatusType
    commonErrorTypeTitleDetailStatus:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailStatusType'
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: Information about the error.
        status:
          type: integer
          description: The error's HTTP status code.
      title: commonErrorTypeTitleDetailStatus
    CommonErrorNameMessageError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: CommonErrorNameMessageError
    commonErrorNameMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageError'
          description: Information about the error.
      title: commonErrorNameMessage
    GetCollectionsRequestUnauthorizedError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: GetCollectionsRequestUnauthorizedError
    CommonErrorTypeTitleDetailDetail:
      oneOf:
        - type: string
        - type: object
          additionalProperties:
            description: Any type
      description: Information about the error.
      title: CommonErrorTypeTitleDetailDetail
    commonErrorTypeTitleDetail:
      type: object
      properties:
        type:
          type: string
          description: The type of error.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailDetail'
          description: Information about the error.
      title: commonErrorTypeTitleDetail
    GetCollectionsRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: GetCollectionsRequestInternalServerError
  securitySchemes:
    PostmanApiKey:
      type: apiKey
      in: header
      name: x-api-key
    scimApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        A valid [SCIM API
        key](https://learning.postman.com/docs/administration/scim-provisioning/scim-provisioning-overview/#generating-scim-api-key)
        for calls to SCIM endpoints.
    basicAuth:
      type: http
      scheme: basic

```

## Examples

### 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.getpostman.com/collections"

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

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

print(response.json())
```

```javascript Successful Response
const url = 'https://api.getpostman.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.getpostman.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.getpostman.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.getpostman.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.getpostman.com/collections', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.getpostman.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.getpostman.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.getpostman.com/collections"

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

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

print(response.json())
```

```javascript Invalid Workspace
const url = 'https://api.getpostman.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.getpostman.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.getpostman.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.getpostman.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.getpostman.com/collections', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Invalid Workspace
using RestSharp;

var client = new RestClient("https://api.getpostman.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.getpostman.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()
```