# Suppressions

Manage and add your suppressions using the API

# **Add Manual Suppressions**

Add suppressions manually with detailed sender and recipient information.

## Request Header

```http
POST https://api.cm.com/email/suppression/v1/accounts/{logicalAccountId}/manual
Content-Type: application/json
```

| **Parameter**    | **Type** | **Required** | **Description**                |
| ---------------- | -------- | ------------ | ------------------------------ |
| logicalAccountId | UUID     | Yes          | The logical account identifier |

| **Header Name** | **Type** | **Required** | **Description**            |
| --------------- | -------- | ------------ | -------------------------- |
| Content-Type    | string   | Yes          | Must be "application/json" |

## Request Body

```json
[
  {
    "sender": "marketing@company.com",
    "recipient": "user@example.com",
    "unsubscribeType": 1,
    "emailType": 0
  },
  {
    "sender": "newsletter@company.com", 
    "recipient": "customer@domain.com",
    "unsubscribeType": 1,
    "emailType": 1
  }
]
```
```yaml
- sender: "marketing@company.com"
  recipient: "user@example.com"
  unsubscribeType: 1
  emailType: 0
- sender: "newsletter@company.com"
  recipient: "customer@domain.com"
  unsubscribeType: 1
  emailType: 1
```

* Maximum 10 suppression requests per API call
* All fields are required for each suppression entry

## Response Body

**Successful Response (200)**

```json
{
  "success": true,
  "message": "Success",
  "status": 200,
  "data": null
}
```
```yaml
success: true
message: "Success"
status: 200
data: null
```

## Error Responses

**Invalid Request - Empty Account ID (400)**

```json
{
  "success": true,
  "message": "Logical account is empty",
  "status": 200,
  "data": null
}
```
```yaml
success: true
message: "Logical account is empty"
status: 200
data: null
```

**Invalid Request - Null Request (400)**

```json
{
  "success": true,
  "message": "Manual unsubscribe request object is null",
  "status": 200,
  "data": null
}
```
```yaml
success: true
message: "Manual unsubscribe request object is null"
status: 200
data: null
```

**Request Limit Exceeded (400)**

```json
{
  "success": false,
  "message": "Unsubscription requests are restricted to 10 recipients at a time",
  "status": 400,
  "data": null
}
```
```yaml
success: false
message: "Unsubscription requests are restricted to 10 recipients at a time"
status: 400
data: null
```

**Server Error (500)**

```json
{
  "success": false,
  "message": "Failed to unsubscribe from email list",
  "status": 500,
  "data": null
}
```
```yaml
success: false
message: "Failed to unsubscribe from email list"
status: 500
data: null
```

***

# **Add Suppression via Unique Key**

Handle unsubscribes from email unsubscribe links using unique keys.

## Request Header

```http
POST https://api.cm.com/email/suppression/v1/{uniqueKey}
Content-Type: application/json
```

| **Parameter** | **Type** | **Required** | **Description**                        |
| ------------- | -------- | ------------ | -------------------------------------- |
| uniqueKey     | UUID     | Yes          | Unique key from email unsubscribe link |

## Request Body

**With Reason** (Optional)

```json
{
  "unsubscribeReason": "No longer interested in marketing emails"
}
```
```yaml
unsubscribeReason: "No longer interested in marketing emails"
```

**Without Reason** (Optional)

```json
{
  "unsubscribeReason": null
}
```
```yaml
unsubscribeReason: null
```

## Response Body

**Successful Response (200)**

```json
{
  "success": true,
  "message": "Success",
  "status": 200,
  "data": null
}
```
```yaml
success: true
message: "Success"
status: 200
data: null
```

## Error Responses

**Invalid Unique Key (400)**

```json
{
  "success": false,
  "message": "Unique key value is empty",
  "status": 400,
  "data": null
}
```
```yaml
success: false
message: "Unique key value is empty"
status: 400
data: null
```

**Invalid Unsubscribe Link (400)**

```json
{
  "success": false,
  "message": "Cannot unsubscribe from link",
  "status": 400,
  "data": null
}
```
```yaml
success: false
message: "Cannot unsubscribe from link"
status: 400
data: null
```

***

# **List Suppressions**

Retrieve suppression data with filtering and pagination options.

## Request Header

```http
GET https://api.cm.com/email/suppression/v1/accounts/{logicalAccountId}/subscriptions?searchEmail={email}&emailType={type}&pageSize={size}&pageNumber={page}
```

| **Parameter**    | **Type** | **Required** | **Description**                |
| ---------------- | -------- | ------------ | ------------------------------ |
| logicalAccountId | UUID     | Yes          | The logical account identifier |

| **Parameter** | **Type** | **Required** | **Default** | **Description**                                        |
| ------------- | -------- | ------------ | ----------- | ------------------------------------------------------ |
| searchEmail   | string   | No           | null        | Search for specific email address                      |
| emailType     | integer  | No           | -1          | Filter by email type (-1=all, 0=market, 1=high, 2=low) |
| pageSize      | integer  | No           | 10          | Number of results per page (1-100)                     |
| pageNumber    | integer  | No           | 1           | Page number to retrieve (1-based)                      |

## Response Body

**Successful Response (200)**

```json
{
  "success": true,
  "message": "",
  "status": 200,
  "data": {
    "count": 258,
    "unsubscribedEmails": [
      {
        "id": 1661,
        "messageRequestId": "00000000-0000-0000-0000-000000000000",
        "sender": "mannualsender1@example.com",
        "recipient": "mannualrec1@example.com",
        "createdAt": "2025-10-16T23:01:24.158221+00:00",
        "modifiedAt": null,
        "reason": "Manually unsubscribed by user",
        "emailType": 0,
        "unsubscribeType": 1,
        "logicalAccount": "903e1cef-84b3-4500-a9a5-b2ca219f76f5"
      },
      {
        "id": 1660,
        "messageRequestId": "00000000-0000-0000-0000-000000000000",
        "sender": "mannualsender@example.com",
        "recipient": "mannualrec@example.com",
        "createdAt": "2025-10-16T22:57:36.7574+00:00",
        "modifiedAt": null,
        "reason": "Manually unsubscribed by user",
        "emailType": 0,
        "unsubscribeType": 1,
        "logicalAccount": "903e1cef-84b3-4500-a9a5-b2ca219f76f5"
      }
    ]
  }
}
```
```yaml
success: true
message: ""
status: 200
data:
  count: 258
  unsubscribedEmails:
    - id: 1661
      messageRequestId: "00000000-0000-0000-0000-000000000000"
      sender: "mannualsender1@example.com"
      recipient: "mannualrec1@example.com"
      createdAt: "2025-10-16T23:01:24.158221+00:00"
      modifiedAt: null
      reason: "Manually unsubscribed by user"
      emailType: 0
      unsubscribeType: 1
      logicalAccount: "903e1cef-84b3-4500-a9a5-b2ca219f76f5"
    - id: 1660
      messageRequestId: "00000000-0000-0000-0000-000000000000"
      sender: "mannualsender@example.com"
      recipient: "mannualrec@example.com"
      createdAt: "2025-10-16T22:57:36.7574+00:00"
      modifiedAt: null
      reason: "Manually unsubscribed by user"
      emailType: 0
      unsubscribeType: 1
      logicalAccount: "903e1cef-84b3-4500-a9a5-b2ca219f76f5"
```

**Empty Results Response (200)**

```json
{
  "success": true,
  "message": "",
  "status": 200,
  "data": {
    "count": 0,
    "unsubscribedEmails": [
    ]
  }
}
```
```yaml
success: true
message: ""
status: 200
data:
  count: 0
  unsubscribedEmails: []	
```

## Error Response

**Error Response (400)**

```json
{
  "success": false,
  "message": "Failed to fetch email unsubscribe data.",
  "status": 400,
  "data": null
}
```
```yaml
success: false
message: "Failed to fetch email unsubscribe data."
status: 400
data: null
```

**Error Response (500)**

```json
{
  "success": false,
  "message": "Failed to fetch email unsubscribe data.",
  "status": 500,
  "data": null
}
```
```yaml
success: false
message: "Failed to fetch email unsubscribe data."
status: 500
data: null
```

***

# **Remove Suppressions (Bulk)**

Remove multiple suppressed email addresses in a single request.

## Request Header

```http
DELETE https://api.cm.com/email/suppression/v1/accounts/{logicalAccountId}/suppressions/bulk
```

| **Parameter**    | **Type** | **Required** | **Description**                |
| ---------------- | -------- | ------------ | ------------------------------ |
| logicalAccountId | UUID     | Yes          | The logical account identifier |

## Request Body

Array of suppression removal requests:

```json
[
  {
    "sender": "string",
    "recipient": "string",
    "emailType": integer
  },
	{
    "sender": "string",
    "recipient": "string",
    "emailType": integer
  }
]
```
```yaml
- sender: "string"
  recipient: "string"
  emailType: integer
- sender: "string"
  recipient: "string"
  emailType: integer
```

| **Field** | **Type** | **Required** | **Description**                                                |
| --------- | -------- | ------------ | -------------------------------------------------------------- |
| sender    | string   | No           | Email address of the sender (optional)                         |
| recipient | string   | Yes          | Email address to remove from suppressions (valid email format) |
| emailType | integer  | Yes          | Email type (0=Market, 1=HighPriority, 2=LowPriority)           |

## Response Body

**Successful Response (200)**

All suppressions removed successfully:

```json
{
  "success": true,
  "message": "",
  "status": 200,
  "data": {
    "failedRemovals": []
  }
}
```
```yaml
success: true
message: ""
status: 200
data:
  failedRemovals: []
```

Partial success with some failures:

```json
{
  "success": true,
  "message": "",
  "status": 200,
  "data": {
    "failedRemovals": [
      {
        "sender": "sender@example.com",
        "recipient": "recipient@example.com",
        "emailType": 0,
        "reason": "Email address not found in suppressions"
      }
    ]
  }
}
```
```yaml
success: true
message: ""
status: 200
data:
  failedRemovals:
    - sender: "sender@example.com"
      recipient: "recipient@example.com"
      emailType: 0
      reason: "Email address not found in suppressions"
```

## Error Response

**Error Response (400 - Bad Request)**

```json
{
  "success": false,
  "message": "Request list cannot be empty",
  "status": 400,
  "data": null
}
```
```yaml
success: false
message: "Request list cannot be empty"
status: 400
data: null
```

**Error Response (400 - Invalid Logical Account)**

```json
{
  "success": false,
  "message": "Invalid logical account ID",
  "status": 400,
  "data": null
}
```
```yaml
success: false
message: "Invalid logical account ID"
status: 400
data: null
```

**Error Response (500 - Internal Server Error)**

```json
{
  "success": false,
  "message": "Failed to remove email suppressions.",
  "status": 500,
  "data": null
}
```
```yaml
success: false
message: "Failed to remove email suppressions."
status: 500
data: null
```

## Notes

* **Partial Success**: Endpoint returns 200 status even if some removals fail. Check `failedRemovals` array to identify which suppressions failed.
* **Request Validation**: LogicalAccountId must be a valid UUID; request body cannot be empty.
* **Email Type Values**:
  * `0` = Marketing Email
  * `1` = High Priority Transaction Email
  * `2` = Low Priority Transactional Email

# **Suppression Types**

The system supports different types of suppressions based on how they were initiated:

| **Suppression Type** | **Enum Value** | **Description**                         | **Usage**                                     |
| -------------------- | -------------- | --------------------------------------- | --------------------------------------------- |
| HardBounce           | 1              | Permanent delivery failure              | Invalid email addresses, non-existent domains |
| SoftBounce           | 2              | Temporary delivery failure              | Mailbox full, server temporarily unavailable  |
| RequestedBySystem    | 3              | System-initiated suppression            | Automated suppressions based on system rules  |
| RequestedByAdmin     | 4              | Admin-initiated suppression             | Manual suppressions by administrators         |
| UnsubscribedByLink   | 5              | Unsubscribed via email unsubscribe link | Unique key unsubscribes with reason           |
| UnsubscribedByHeader | 6              | Unsubscribed via email header action    | Unique key unsubscribes without reason        |
| ManuallyUnsubscribed | 7              | Manually added by user or admin         | Manual suppressions via API                   |

# **Email Types**

The system categorizes emails into different priority levels:

| **Email Type** | **Enum Value** | **Description**                       | **Use Cases**                      |
| -------------- | -------------- | ------------------------------------- | ---------------------------------- |
| Market         | 0              | Marketing and promotional emails      | Newsletters, promotions, campaigns |
| HighPriority   | 1              | High priority transactional emails    | Password resets, security alerts   |
| LowPriority    | 2              | Low priority transactional emails     | Notifications, updates             |
| All Types      | -1             | Filter for all email types (GET only) | Used in list filtering             |

# **Request Parameters**

## Manual Suppression Request Fields

| **Field**       | **Type** | **Required** | **Description**                                      |
| --------------- | -------- | ------------ | ---------------------------------------------------- |
| sender          | string   | Yes          | Email address of the sender (email format)           |
| recipient       | string   | Yes          | Email address of the recipient (email format)        |
| unsubscribeType | integer  | Yes          | Suppression type (1=Manual, 2=Link, 3=Header)        |
| emailType       | integer  | Yes          | Email type (0=Market, 1=HighPriority, 2=LowPriority) |

## Unique Key Suppression Request Fields

| **Field**         | **Type** | **Required** | **Description**                   |
| ----------------- | -------- | ------------ | --------------------------------- |
| unsubscribeReason | string   | No           | Optional reason for unsubscribing |

## Suppression List Response Fields

| **Field**        | **Type** | **Description**                                      |
| ---------------- | -------- | ---------------------------------------------------- |
| id               | integer  | Unique suppression record ID                         |
| messageRequestId | UUID     | Original message request identifier                  |
| sender           | string   | Email address of the sender                          |
| recipient        | string   | Email address of the recipient                       |
| createdAt        | datetime | When the suppression was created                     |
| modifiedAt       | datetime | When the suppression was last modified               |
| reason           | string   | Reason for the suppression                           |
| emailType        | integer  | Email type (0=Market, 1=HighPriority, 2=LowPriority) |
| unsubscribeType  | integer  | Suppression type (1=Manual, 2=Link, 3=Header)        |
| logicalAccount   | UUID     | Logical account identifier                           |

# **Example Use Cases**

## Marketing Campaign Opt-out

```json
[
  {
    "sender": "marketing@company.com",
    "recipient": "optout-user@example.com",
    "unsubscribeType": 1,
    "emailType": 0
  }
]
```
```yaml
- sender: "marketing@company.com"
  recipient: "optout-user@example.com"
  unsubscribeType: 1
  emailType: 0
```

## Email List Hygiene

Suppress bounced or invalid email addresses:

```json
[
  {
    "sender": "newsletter@company.com",
    "recipient": "bounced@invalid-domain.com",
    "unsubscribeType": 1,
    "emailType": 0
  }
]
```
```yaml
- sender: "newsletter@company.com"
  recipient: "bounced@invalid-domain.com"
  unsubscribeType: 1
  emailType: 0
```

## Segment-Specific Suppressions

Suppress high-priority emails for specific users:

```json
[
  {
    "sender": "alerts@company.com",
    "recipient": "user@example.com",
    "unsubscribeType": 1,
    "emailType": 1
  }
]
```
```yaml
- sender: "alerts@company.com"
  recipient: "user@example.com"
  unsubscribeType: 1
  emailType: 1
```

## Search and Filter Suppressions

Find all marketing suppressions for a specific domain:

```http
GET https://api.cm.com/email/suppression/v1/accounts/903e1cef-84b3-4500-a9a5-b2ca219f76f5/subscriptions?searchEmail=@example.com&emailType=0&pageSize=50
```

## Pagination for Large Lists

Retrieve suppressions in manageable chunks:

```http
GET https://api.cm.com/email/suppression/v1/accounts/903e1cef-84b3-4500-a9a5-b2ca219f76f5/subscriptions?pageSize=25&pageNumber=3
```

# **Rate Limits and Constraints**

* **Manual Suppressions**: Maximum 10 suppressions per request
* **Pagination**: Maximum 100 results per page
* **Search**: Email search supports partial matching

# **Troubleshooting**

1. **Suppression Not Working**: Verify logical account ID and email format
2. **Search Not Finding Results**: Verify search terms and email type filters
3. **Unique Key Invalid**: Ensure unique key is valid and not expired
4. **Batch Limit Exceeded**: Split large suppression lists into batches of 10 or few