# 電子信箱

## 搜尋電子信箱

```javascript
GET https://{API_DOMAIN}/api/v1/email-contact
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/email-contact?contact_id=1"
```

### Query Parameters

| PARAMETER       | REQUIRED | DEFAULT | TYPE   | DESCRIPTION  |
| --------------- | -------- | ------- | ------ | ------------ |
| **page**        | false    | 1       | Number | 目前在第幾頁       |
| **per\_page**   | false    | 15      | Number | 每頁呈現多少筆      |
| **contact\_id** | false    | NULL    | Number | 客戶的id        |
| **name**        | false    | NULL    | String | 定義的 Email 名稱 |
| **description** | false    | NULL    | String | Email 備註     |
| **address**     | false    | NULL    | String | Email 位址     |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                                |
| -------- | ---------------- | -------------------------------------------------------------------------- |
| **data** | Array of objects | [電子信箱陣列](/developer/api/response-object.md#dian-zi-xin-xiang-emailcontact) |
| **meta** | Object           | Pagination meta                                                            |

```javascript
{
    "data": [
        {
            "id": 1,
            "address": "harvey.bartholome@gmail.com",
            "contact_id": 1,
            "draft": null,
            "name": "Jaiden Champlin III",
            "description": "Pariatur dolorem aut voluptatibus. Aut pariatur voluptatum ratione atque sit. Et inventore quo voluptates animi.",
            "contact": {
                "id": 1,
                "membership_no": "8771639",
                "identity_no": "418099",
                "first_name": "Angelita",
                "last_name": "D'Amore",
                "gender": 0,
                "birth_at": "1985-08-27 00:00:00",
                "created_at": "2019-04-10 03:01:41",
                "updated_at": "2019-04-10 03:01:41",
                "profile_id": 1,
                "sponsor_id": null,
                "disturb_setting": null
            }
        },
        {
            "id": 5,
            "address": "shyanne47@hotmail.com",
            "contact_id": 1,
            "draft": null,
            "name": "Mikayla Funk",
            "description": "Possimus optio molestiae perspiciatis distinctio. Vel incidunt ut unde. Laudantium eaque distinctio officia eum error odit.",
            "contact": {
                "id": 1,
                "membership_no": "8771639",
                "identity_no": "418099",
                "first_name": "Angelita",
                "last_name": "D'Amore",
                "gender": 0,
                "birth_at": "1985-08-27 00:00:00",
                "created_at": "2019-04-10 03:01:41",
                "updated_at": "2019-04-10 03:01:41",
                "profile_id": 1,
                "sponsor_id": null,
                "disturb_setting": null
            }
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}
```

## 取得指定電子信箱

```javascript
https://{API_DOMAIN}/api/v1/email-contact/{email_contact}
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/email-contact/1
```

| PROPERTY | TYPE   | DESCRIPTION                                                              |
| -------- | ------ | ------------------------------------------------------------------------ |
| **data** | Object | [電子信箱](/developer/api/response-object.md#dian-zi-xin-xiang-emailcontact) |

### URL Parameters

| PARAMETER          | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                                  |
| ------------------ | -------- | ------- | ------ | ---------------------------------------------------------------------------- |
| **email\_contact** | True     | Null    | Number | [電子信箱](/developer/api/response-object.md#dian-zi-xin-xiang-emailcontact)的 id |

### Response

請參考[電子信箱](/developer/api/response-object.md#dian-zi-xin-xiang-emailcontact)回應格式

```javascript

{
    "data": {
        "id": 1,
        "address": "harvey.bartholome@gmail.com",
        "contact_id": 1,
        "draft": null,
        "name": "Jaiden Champlin III",
        "description": "Pariatur dolorem aut voluptatibus. Aut pariatur voluptatum ratione atque sit. Et inventore quo voluptates animi.",
        "contact": {
            "id": 1,
            "membership_no": "8771639",
            "identity_no": "418099",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "gender": 0,
            "birth_at": "1985-08-27 00:00:00",
            "created_at": "2019-04-10 03:01:41",
            "updated_at": "2019-04-10 03:01:41",
            "profile_id": 1,
            "sponsor_id": null,
            "disturb_setting": null
        }
    }
}
```

## 新增電子信箱

指定客戶新增電子信箱

```javascript
POST https://{API_DOMAIN}/api/v1/email-contact
```

```javascript
curl -X POST
    -H "Content-Type: application/json"
    '{"contact_id":1,"address":"loren18@ortiz.biz","name":"Theresia Zieme"}'
    https://{API_HOST}/api/v1/email-contact
```

### Parameters

| PARAMETER       | REQUIRED | DEFAULT | TYPE   | DESCRIPTION |
| --------------- | -------- | ------- | ------ | ----------- |
| **contact\_id** | true     | NULL    | Number | 客戶的id       |
| **address**     | true     | NULL    | String | 電子信箱地址      |
| **name**        | false    | NULL    | String | 電子信箱自定義名稱   |
| **description** | false    | NULL    | String | 電子信箱自定義描述   |

### Response

請參考[電子信箱](/developer/api/response-object.md#dian-zi-xin-xiang-emailcontact)回應格式

```javascript
{
    "data": {
        "id": 3,
        "address": "loren18@ortiz.biz",
        "contact_id": 1,
        "draft": null,
        "name": "Theresia Zieme",
        "description": null,
        "contact": {
            "id": 1,
            "membership_no": "8771639",
            "identity_no": "418099",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "gender": 0,
            "birth_at": "1985-08-27 00:00:00",
            "created_at": "2019-04-10 03:01:41",
            "updated_at": "2019-04-10 03:01:41",
            "profile_id": 1,
            "sponsor_id": null,
            "disturb_setting": null
        }
    }
}
```

## 更新指定電子信箱

```javascript
PUT https://{API_DOMAIN}/api/v1/email-contact/{email_contact}
```

```javascript
curl -X PUT
    -H "Content-Type: application/json"
    '{"name":"Sharon"}'
    https://{API_HOST}/api/v1/email-contact/1
```

### Parameters

| PARAMETER       | REQUIRED | DEFAULT | TYPE   | DESCRIPTION |
| --------------- | -------- | ------- | ------ | ----------- |
| **address**     | true     | NULL    | String | 電子信箱地址      |
| **name**        | false    | NULL    | String | 電子信箱自定義名稱   |
| **description** | false    | NULL    | String | 電子信箱自定義描述   |

### Response

請參考[電子信箱](/developer/api/response-object.md#dian-zi-xin-xiang-emailcontact)回應格式

```javascript
{
    "data": {
        "id": 3,
        "address": "loren18@ortiz.biz",
        "contact_id": 1,
        "draft": null,
        "name": "Sharon",
        "description": null,
        "contact": {
            "id": 1,
            "membership_no": "8771639",
            "identity_no": "418099",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "gender": 0,
            "birth_at": "1985-08-27 00:00:00",
            "created_at": "2019-04-10 03:01:41",
            "updated_at": "2019-11-10 03:01:41",
            "profile_id": 1,
            "sponsor_id": null,
            "disturb_setting": null
        }
    }
}
```

## 刪除電子信箱

Http status 為 204

```javascript
https://{API_DOMAIN}/api/v1/email-contact/{email_contact}
```

```javascript
curl -X DELETE
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/email-contact?contact_id=1"
```

### URL Parameters

| PARAMETER          | REQUIRED | DEFAULT | TYPE   | DESCRIPTION |
| ------------------ | -------- | ------- | ------ | ----------- |
| **email\_contact** | true     | NULL    | Number | 電子信箱的id     |

```
{}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.firstline.cc/developer/api/dian-zi-xin-xiang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
