---
title: "Get an opt-out list"
description: "Returns a single opt-out list, including how many opt-outs it contains."
version: "v2"
---

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

Path: MessagePort API › Opt-out lists

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

Returns a single opt-out list, including how many opt-outs it contains.

## Authentication

- `basicAuth`, http, header `Authorization`

## Path parameters

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

## Code samples

### cURL

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

### TypeScript

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

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

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

print(response.text)
```

## Responses

### 200

The opt-out list.

#### Example

```json
{
  "data": {
    "id": 2,
    "name": "Marketing Opt-Outs",
    "is_default": false,
    "opt_out_count": 89,
    "created_at": "2024-03-10T14:30:22.000000Z",
    "updated_at": "2024-03-15T09:45:18.000000Z"
  }
}
```

- `data` (`getOptoutList.response.200.data`; object, optional)
  - example `{"id":2,"name":"Marketing Opt-Outs","is_default":false,"opt_out_count":89,"created_at":"2024-03-10T14:30:22.000000Z","updated_at":"2024-03-15T09:45:18.000000Z"}`
  - `id` (`getOptoutList.response.200.data.id`; integer, optional)
  - `name` (`getOptoutList.response.200.data.name`; string, optional)
  - `is_default` (`getOptoutList.response.200.data.is_default`; boolean, optional) — Whether this is your default opt-out list.
  - `opt_out_count` (`getOptoutList.response.200.data.opt_out_count`; integer, optional) — Number of opt-outs in the list.
  - `created_at` (`getOptoutList.response.200.data.created_at`; string, optional)
    - format `date-time`
  - `updated_at` (`getOptoutList.response.200.data.updated_at`; string, optional)
    - format `date-time`

### 401

Missing, malformed or invalid API credentials.

#### Example

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

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

### 404

The resource does not exist.

#### Example

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

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


Source: https://dev.messageport.com.au/api/optout-lists/get/index.md
