---
title: "List opt-outs"
description: "Returns a paginated list of opt-outs across all of your opt-out lists, 100 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-outs

`GET /v2/optouts`

Returns a paginated list of opt-outs across all of your opt-out lists, 100 per page.

## Authentication

- `basicAuth`, http, header `Authorization`

## Query parameters

- `search` (`listOptouts.query.search`; string, optional) — Partial or whole phone number.
- `page` (`listOptouts.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/optouts \
  --header 'Authorization: Basic <credentials>'
```

### TypeScript

```typescript
const url = 'https://app.touchsms.com.au/api/v2/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/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` (`listOptouts.response.200.data`; array<object>, optional)
  - `id` (`listOptouts.response.200.data.id`; integer, optional)
  - `user` (`listOptouts.response.200.data.user`; integer, optional) — ID of the user that owns the opt-out.
  - `number` (`listOptouts.response.200.data.number`; string, optional) — Opted-out number in E.164 format.
  - `method` (`listOptouts.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` (`listOptouts.response.200.data.opt_out_list`; object, optional) — The list this opt-out belongs to.
    - `id` (`listOptouts.response.200.data.opt_out_list.id`; integer, optional)
    - `name` (`listOptouts.response.200.data.opt_out_list.name`; string, optional)
    - `is_default` (`listOptouts.response.200.data.opt_out_list.is_default`; boolean, optional)
  - `updated` (`listOptouts.response.200.data.updated`; string, optional)
    - format `date-time`
  - `created` (`listOptouts.response.200.data.created`; string, optional)
    - format `date-time`
- `links` (`listOptouts.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` (`listOptouts.response.200.links.first`; string | null, optional)
    - format `uri`
  - `last` (`listOptouts.response.200.links.last`; string | null, optional)
    - format `uri`
  - `prev` (`listOptouts.response.200.links.prev`; string | null, optional)
    - format `uri`
  - `next` (`listOptouts.response.200.links.next`; string | null, optional)
    - format `uri`
- `meta` (`listOptouts.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` (`listOptouts.response.200.meta.current_page`; integer, optional)
  - `from` (`listOptouts.response.200.meta.from`; integer | null, optional)
  - `last_page` (`listOptouts.response.200.meta.last_page`; integer, optional)
  - `path` (`listOptouts.response.200.meta.path`; string, optional)
    - format `uri`
  - `per_page` (`listOptouts.response.200.meta.per_page`; integer, optional)
  - `to` (`listOptouts.response.200.meta.to`; integer | null, optional)
  - `total` (`listOptouts.response.200.meta.total`; integer, optional)
  - `links` (`listOptouts.response.200.meta.links`; array<object>, optional) — Page links for building pagination controls.
    - `url` (`listOptouts.response.200.meta.links.url`; string | null, optional)
    - `label` (`listOptouts.response.200.meta.links.label`; string, optional)
    - `active` (`listOptouts.response.200.meta.links.active`; boolean, optional)

### 401

Missing, malformed or invalid API credentials.

#### Example

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

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


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