---
title: "List opt-outs in a list"
description: "Returns a paginated list of the opt-outs in one opt-out list, 50 per page."
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 › Opt-out lists

`GET /v2/optout-lists/{optoutList}/optouts`

Returns a paginated list of the opt-outs in one opt-out list, 50 per page.

## Authentication

- `basicAuth`, http, header `Authorization`

## Path parameters

- `optoutList` (`listOptoutListOptouts.path.optoutList`; integer, required) — Opt-out list ID.

## Query parameters

- `search` (`listOptoutListOptouts.query.search`; string, optional) — Partial or whole phone number, or the first name or surname of a matching contact.
- `page` (`listOptoutListOptouts.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/optout-lists/2/optouts \
  --header 'Authorization: Basic <credentials>'
```

### TypeScript

```typescript
const url = 'https://app.touchsms.com.au/api/v2/optout-lists/2/optouts';
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/optout-lists/2/optouts"

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

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

print(response.text)
```

## Responses

### 200

A page of opt-outs.

#### Example

```json
{
  "data": [
    {
      "id": 12345,
      "user": 5678,
      "number": "+61412345678",
      "method": "reply",
      "opt_out_list": {
        "id": 1,
        "name": "Default Opt-Out List",
        "is_default": true
      },
      "updated": "2024-03-11T02:14:07.000000Z",
      "created": "2024-03-11T02:14:07.000000Z"
    }
  ],
  "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` (`listOptoutListOptouts.response.200.data`; array<object>, optional)
  - `id` (`listOptoutListOptouts.response.200.data.id`; integer, optional)
  - `user` (`listOptoutListOptouts.response.200.data.user`; integer, optional) — ID of the user that owns the opt-out.
  - `number` (`listOptoutListOptouts.response.200.data.number`; string, optional) — Opted-out number in E.164 format.
  - `method` (`listOptoutListOptouts.response.200.data.method`; string | null, optional) — How the opt-out was created.
    - one of `"manual"`, `"import"`, `"link"`, `"reply"`, `"chat"`, `"api"`, `"workflow"`, `null`
  - `opt_out_list` (`listOptoutListOptouts.response.200.data.opt_out_list`; object, optional) — The list this opt-out belongs to.
    - `id` (`listOptoutListOptouts.response.200.data.opt_out_list.id`; integer, optional)
    - `name` (`listOptoutListOptouts.response.200.data.opt_out_list.name`; string, optional)
    - `is_default` (`listOptoutListOptouts.response.200.data.opt_out_list.is_default`; boolean, optional)
  - `updated` (`listOptoutListOptouts.response.200.data.updated`; string, optional)
    - format `date-time`
  - `created` (`listOptoutListOptouts.response.200.data.created`; string, optional)
    - format `date-time`
- `links` (`listOptoutListOptouts.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` (`listOptoutListOptouts.response.200.links.first`; string | null, optional)
    - format `uri`
  - `last` (`listOptoutListOptouts.response.200.links.last`; string | null, optional)
    - format `uri`
  - `prev` (`listOptoutListOptouts.response.200.links.prev`; string | null, optional)
    - format `uri`
  - `next` (`listOptoutListOptouts.response.200.links.next`; string | null, optional)
    - format `uri`
- `meta` (`listOptoutListOptouts.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` (`listOptoutListOptouts.response.200.meta.current_page`; integer, optional)
  - `from` (`listOptoutListOptouts.response.200.meta.from`; integer | null, optional)
  - `last_page` (`listOptoutListOptouts.response.200.meta.last_page`; integer, optional)
  - `path` (`listOptoutListOptouts.response.200.meta.path`; string, optional)
    - format `uri`
  - `per_page` (`listOptoutListOptouts.response.200.meta.per_page`; integer, optional)
  - `to` (`listOptoutListOptouts.response.200.meta.to`; integer | null, optional)
  - `total` (`listOptoutListOptouts.response.200.meta.total`; integer, optional)
  - `links` (`listOptoutListOptouts.response.200.meta.links`; array<object>, optional) — Page links for building pagination controls.
    - `url` (`listOptoutListOptouts.response.200.meta.links.url`; string | null, optional)
    - `label` (`listOptoutListOptouts.response.200.meta.links.label`; string, optional)
    - `active` (`listOptoutListOptouts.response.200.meta.links.active`; boolean, optional)

### 401

Missing, malformed or invalid API credentials.

#### Example

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

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

### 403

The resource exists but does not belong to you, or you lack permission.

#### Example

```json
{
  "message": "This action is unauthorized."
}
```

- `message` (`listOptoutListOptouts.response.403.message`; string, required)

### 404

The resource does not exist.

#### Example

```json
{
  "message": "Not Found"
}
```

- `message` (`listOptoutListOptouts.response.404.message`; string, required)


Source: https://dev.touchsms.com.au/api/optout-lists/list-optouts/index.md
