---
title: "List groups"
description: "Returns a paginated list of the contact groups on your account."
version: "v2"
---

> Documentation Index
> Fetch the complete documentation index at: https://dev.touchsms.com.au/llms.txt
> Use this file to discover all available pages before exploring further.

Path: touchSMS API › Groups

`GET /v2/groups`

Returns a paginated list of the contact groups on your account.

## Authentication

- `basicAuth`, http, header `Authorization`

## Query parameters

- `search` (`listGroups.query.search`; string, optional) — Search term.
- `sort_by` (`listGroups.query.sort_by`; string, optional) — Field to sort by.
  - one of `"name"`, `"created"`; default `"name"`
- `sort_order` (`listGroups.query.sort_order`; string, optional) — Sort direction.
  - one of `"asc"`, `"desc"`; default `"asc"`
- `per_page` (`listGroups.query.per_page`; integer, optional) — Results per page.
  - min 10; max 200; default `50`
- `page` (`listGroups.query.page`; integer, optional) — Page number. Prefer following `links.next` until it is `null`.
  - min 1; default `1`

## Code samples

### cURL

```bash
curl --request GET \
  --url https://app.touchsms.com.au/api/v2/groups \
  --header 'Authorization: Basic <credentials>'
```

### TypeScript

```typescript
const url = 'https://app.touchsms.com.au/api/v2/groups';
const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://app.touchsms.com.au/api/v2/groups"

headers = {"Authorization": "Basic <credentials>"}

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

print(response.text)
```

## Responses

### 200

A page of groups.

#### Example

```json
{
  "data": [
    {
      "id": 512,
      "name": "Customers",
      "status": true,
      "group_email": "group-512@example.com",
      "is_global": false,
      "updated": "2024-03-11T02:14:07Z",
      "created": "2024-02-02T23:51:19Z"
    }
  ],
  "links": {
    "first": "https://app.touchsms.com.au/api/v2/contacts?page=1",
    "last": "https://app.touchsms.com.au/api/v2/contacts?page=8",
    "prev": null,
    "next": "https://app.touchsms.com.au/api/v2/contacts?page=2"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 8,
    "path": "https://app.touchsms.com.au/api/v2/contacts",
    "per_page": 50,
    "to": 50,
    "total": 400
  }
}
```

- `data` (`listGroups.response.200.data`; array<object>, optional)
  - `id` (`listGroups.response.200.data.id`; integer, optional)
  - `name` (`listGroups.response.200.data.name`; string, optional)
  - `status` (`listGroups.response.200.data.status`; boolean, optional) — Whether the group is active.
  - `group_email` (`listGroups.response.200.data.group_email`; string | null, optional) — Email-to-SMS address that sends to every contact in the group.
    - format `email`
  - `is_global` (`listGroups.response.200.data.is_global`; boolean, optional) — Whether the group is shared across the whole account.
  - `updated` (`listGroups.response.200.data.updated`; string, optional)
    - format `date-time`
  - `created` (`listGroups.response.200.data.created`; string, optional)
    - format `date-time`
- `links` (`listGroups.response.200.links`; object, optional) — Links to other pages. `next` is `null` on the last page.
  - example `{"first":"https://app.touchsms.com.au/api/v2/contacts?page=1","last":"https://app.touchsms.com.au/api/v2/contacts?page=8","prev":null,"next":"https://app.touchsms.com.au/api/v2/contacts?page=2"}`
  - `first` (`listGroups.response.200.links.first`; string | null, optional)
    - format `uri`
  - `last` (`listGroups.response.200.links.last`; string | null, optional)
    - format `uri`
  - `prev` (`listGroups.response.200.links.prev`; string | null, optional)
    - format `uri`
  - `next` (`listGroups.response.200.links.next`; string | null, optional)
    - format `uri`
- `meta` (`listGroups.response.200.meta`; object, optional) — Position in the result set. Read `per_page` rather than assuming a page size.
  - example `{"current_page":1,"from":1,"last_page":8,"path":"https://app.touchsms.com.au/api/v2/contacts","per_page":50,"to":50,"total":400}`
  - `current_page` (`listGroups.response.200.meta.current_page`; integer, optional)
  - `from` (`listGroups.response.200.meta.from`; integer | null, optional)
  - `last_page` (`listGroups.response.200.meta.last_page`; integer, optional)
  - `path` (`listGroups.response.200.meta.path`; string, optional)
    - format `uri`
  - `per_page` (`listGroups.response.200.meta.per_page`; integer, optional)
  - `to` (`listGroups.response.200.meta.to`; integer | null, optional)
  - `total` (`listGroups.response.200.meta.total`; integer, optional)
  - `links` (`listGroups.response.200.meta.links`; array<object>, optional) — Page links for building pagination controls.
    - `url` (`listGroups.response.200.meta.links.url`; string | null, optional)
    - `label` (`listGroups.response.200.meta.links.label`; string, optional)
    - `active` (`listGroups.response.200.meta.links.active`; boolean, optional)

### 401

Missing, malformed or invalid API credentials.

#### Example

```json
{
  "message": "Unauthenticated."
}
```

- `message` (`listGroups.response.401.message`; string, required)

### 422

The request failed validation. `errors` lists the messages for each invalid field.

#### Example

```json
{
  "message": "The messages field is required.",
  "errors": {
    "messages": [
      "The messages field is required."
    ]
  }
}
```

- `message` (`listGroups.response.422.message`; string, optional)
- `errors` (`listGroups.response.422.errors`; map<array<string>>, optional)


Source: https://dev.touchsms.com.au/api/groups/list/index.md
