# Create a mailing list

Creates a mailing list.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/mail/v1/mailgroups
HTTP Method | POST
Rate Limit | [100 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.** | Search, create, manage, and delete mailing lists(mail:mailgroup)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer t-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Request body

Parameter | Type | Required | Description
---|---|---|---
email | string | No | Mailing list address<br>**Example value**: "test_mail_group@xxx.xx"
name | string | No | Mailing list name<br>**Example value**: "test mail group"
description | string | No | Mailing list description<br>**Example value**: "mail group for testing"
who_can_send_mail | string | No | Who can send emails to this mailing list<br>**Example value**: "ALL_INTERNAL_USERS"<br>**Optional values are**:<br>- ANYONE：Anyone<br>- ALL_INTERNAL_USERS：Organization members only<br>- ALL_GROUP_MEMBERS：Mailing list members only<br>- CUSTOM_MEMBERS：Specified members

### Request body example
```json
{
    "email": "test_mail_group@xxx.xx",
    "name": "test mail group",
    "description": "mail group for testing",
    "who_can_send_mail": "ALL_INTERNAL_USERS"
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | mailgroup | \-
mailgroup_id | string | Mailing list ID
email | string | Mailing list address
name | string | Mailing list name
description | string | Mailing list description
direct_members_count | string | Number of mailing list members
include_external_member | boolean | Whether it includes external members
include_all_company_member | boolean | Whether it is an all-staff mailing list
who_can_send_mail | string | Who can send emails to this mailing list<br>**Optional values are**:<br>- ANYONE：Anyone<br>- ALL_INTERNAL_USERS：Organization members only<br>- ALL_GROUP_MEMBERS：Mailing list members only<br>- CUSTOM_MEMBERS：Specified members

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "mailgroup_id": "xxxxxxxxxxxxxxx",
        "email": "test_mail_group@xxx.xx",
        "name": "test mail group",
        "description": "mail group for testing",
        "direct_members_count": "10",
        "include_external_member": true,
        "include_all_company_member": false,
        "who_can_send_mail": "ALL_INTERNAL_USERS"
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 1234019 | mail address's domain not found | Check whether this domain exists.
409 | 1234006 | email address has been used | The email address is already in use. Please use another email address.
400 | 1234008 | request parameter error | Check whether the request parameters are correct.
400 | 1234030 | mailing group count is over max limit | mailing group count is over max limit
409 | 1234033 | email address has been used by another member as login account | email address has been used by another member as login account

