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

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

Gets all of a team's Postman [groups](https://learning.postman.com/docs/collaborating-in-postman/user-groups/).

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

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

## Response

### 200

Successful Response

- `data` (list of GetGroupsDataItems, optional) — A list of Postman groups.

## Errors

### 401 Unauthorized Error

Unauthorized

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

### 403 Forbidden Error

Forbidden

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

### 500 Internal Server Error

Internal Server Error

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

## Types

### GetGroupsDataItems

Information about the group.

- `id` (double, optional) — The group's ID.
- `teamId` (double, optional) — The group's Postman team ID.
- `name` (string, optional) — The group's name.
- `summary` (string, optional) — The group's summary.
- `createdBy` (double, optional) — The ID of ther user who created the group.
- `createdAt` (datetime, optional) — The date and time at which the group was created.
- `updatedAt` (datetime, optional) — The date and time at which the group was updated.
- `members` (list of double, optional) — The group members' IDs.
- `roles` (list of string, optional) — The group's roles.

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

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

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

## Examples

**Response**

```json
{
  "data": [
    {
      "id": 123,
      "teamId": 1,
      "name": "API Test Group",
      "summary": "API testing group.",
      "createdBy": 12345678,
      "createdAt": "2024-10-03T14:05:05.000Z",
      "updatedAt": "2024-10-03T14:05:05.000Z",
      "members": [
        12345678,
        87654321,
        56781234
      ],
      "roles": [
        "user"
      ]
    },
    {
      "id": 456,
      "teamId": 1,
      "name": "Billing",
      "summary": "",
      "createdBy": 12345678,
      "createdAt": "2024-03-06T11:01:42.000Z",
      "updatedAt": "2024-04-04T13:36:11.000Z",
      "members": [
        56789012
      ],
      "roles": [
        "user"
      ]
    },
    {
      "id": 789,
      "teamId": 1,
      "name": "Collaboration",
      "summary": "",
      "createdBy": 12345678,
      "createdAt": "2024-03-15T19:44:20.000Z",
      "updatedAt": "2024-03-15T19:44:20.000Z",
      "members": [
        12345678,
        87654321,
        56781234,
        78906531,
        45507812
      ],
      "roles": [
        "user"
      ]
    }
  ]
}
```

**SDK Code**

```python Successful Response
import requests

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

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

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

print(response.json())
```

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

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

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

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

```csharp Successful Response
using RestSharp;

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