---
title: "Get an opt-out"
description: "Returns a single opt-out and the list it belongs to."
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/{optout}`

Returns a single opt-out and the list it belongs to.

## Authentication

- `basicAuth`, http, header `Authorization`

## Path parameters

- `optout` (`getOptout.path.optout`; integer, required) — Opt-out ID.

## Code samples

### cURL

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

### TypeScript

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

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

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

print(response.text)
```

## Responses

### 200

The opt-out.

#### 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"
  }
}
```

- `data` (`getOptout.response.200.data`; object, optional)
  - example `{"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"}`
  - `id` (`getOptout.response.200.data.id`; integer, optional)
  - `user` (`getOptout.response.200.data.user`; integer, optional) — ID of the user that owns the opt-out.
  - `number` (`getOptout.response.200.data.number`; string, optional) — Opted-out number in E.164 format.
  - `method` (`getOptout.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` (`getOptout.response.200.data.opt_out_list`; object, optional) — The list this opt-out belongs to.
    - `id` (`getOptout.response.200.data.opt_out_list.id`; integer, optional)
    - `name` (`getOptout.response.200.data.opt_out_list.name`; string, optional)
    - `is_default` (`getOptout.response.200.data.opt_out_list.is_default`; boolean, optional)
  - `updated` (`getOptout.response.200.data.updated`; string, optional)
    - format `date-time`
  - `created` (`getOptout.response.200.data.created`; string, optional)
    - format `date-time`

### 401

Missing, malformed or invalid API credentials.

#### Example

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

- `message` (`getOptout.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` (`getOptout.response.403.message`; string, required)

### 404

The resource does not exist.

#### Example

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

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


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