# List Emails

List mail messages in a user mailbox.
**Notice**：When accessing with app permissions, you need to apply for data permissions for mail data resources.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/mail/v1/user_mailboxes/:user_mailbox_id/messages
HTTP Method | GET
Rate Limit | [10 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.** | Retrieve emails(mail:user_mailbox.message:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>or<br>`user_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-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)

### Path parameters

Parameter | Type | Description
---|---|---
user_mailbox_id | string | User email address. When accessing as a user, you can enter "me" to represent the current calling interface user<br>**Example value**: "user@xxx.xx or me"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
page_size | int | Yes | page size<br>**Example value**: 1<br>**Data validation rules**:<br>- Value range: `1` ～ `20`
page_token | string | No | Page identifier. It is not filled in the first request, indicating traversal from the beginning; when there will be more groups, the new page_token will be returned at the same time, and the next traversal can use the page_token to get more groups<br>**Example value**: xxx
folder_id | string | No | Folder ID. The method for obtaining ID is shown in [List Email Folders](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/mail-v1/user_mailbox-folder/list)<br>**Example value**: INBOX or user folder id
only_unread | boolean | No | Only query unread emails<br>**Example value**: true
label_id | string | No | Label ID<br>**Example value**: FLAGGED

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
items | string\[\] | message id list
page_token | string | Page identifier, when has_more is true, a new page_token will also be returned. Otherwise, page_token will not be returned
has_more | boolean | Whether the response body has more parameters

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "items": [
            "ZWEyNGRmY2QtOTVlNy00NzlhLTg5MjItMjFjOTQ5ZjIzZjJl"
        ],
        "page_token": "xxx",
        "has_more": true
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 1230001 | Invalid param | Please retry after modifying the parameters.
403 | 1230002 | No permission | No permission access, please confirm whether the application has permission to access the resource. If you access as a user, please confirm that you have access permissions for this user; if you access as a tenant, please confirm that you have applied for the corresponding data scope permissions.
500 | 1230003 | Internal error | Please try again later

