---
# System prepended metadata

title: Members Renewal API

---


# API docs update

## Base URL
### 正式站 (Production):
- [https://www.diageocrm.com.tw/api](https://www.diageocrm.com.tw/api)

### 測試站 (Testing):
- https://diageocrm-com.diageoplatform.com/api

## Endpoints

### 1. Member Renewal
#### `POST /members/renew`

##### Description
Updates or creates a member profile with loyalty information.

##### Request Parameters
| Parameter | Type | Required | Validation Rules |
|-----------|------|----------|-----------------|
| `last_name` | String | Yes | Must be present |
| `first_name` | String | Yes | Must be present |
| `birthday` | Date | Yes | Must be in format YYYY/MM/DD, user must be 18+ |
| `cell_phone` | String | Yes | Must start with 09, exactly 10 digits |
| `gender` | Integer | Yes | Must be an integer |
| `email` | String | No | Must be a valid email format |
| `line_id` | String | Yes | Must be present |
| `yearly_income` | Mixed | Yes | Must be present |
| `region` | String | Yes | Must be present |
| `event_code` | String | No |  |

##### Responses
###### Successful Response
- **Status Code**: 200 OK
- **Body**:
```json
{
  "error": false,
  "message": "成功"
}
```

###### Error Responses
###### Validation Error
- **Status Code**: 422 Unprocessable Entity
- **Body**:
```json
{
  "error": true,
  "message": "參數有誤",
  "validatorErrors": {
    "field_name": ["Error details"]
  }
}
```

###### Processing Error
- **Status Code**: 400 Bad Request
- **Body**:
```json
{
  "error": true,
  "message": "Error description"
}
```

### 2. Basic Question Answer
#### `POST /basic-question/answer`

##### Description
Submits answers to basic questions for a member identified by Line ID.

##### Request Parameters
| Parameter | Type | Required | Validation Rules |
|-----------|------|----------|-----------------|
| `line_id` | String | Yes | Must be present, corresponding member must exist |
| `answers` | Array | Yes | Array of answer objects |

##### Answer Object Structure
| Parameter | Type | Required | Validation Rules |
|-----------|------|----------|-----------------|
| `question_id` | Integer | Yes | Must correspond to an existing basic question |
| `answer` | Mixed | Yes | Answer to the specific question |

##### Responses
###### Successful Response
- **Status Code**: 200 OK
- **Body**:
```json
{
  "error": false,
  "message": "成功"
}
```

###### Error Responses
###### Member Not Found
- **Status Code**: 400 Bad Request
- **Body**:
```json
{
  "error": true,
  "message": "查無對應會員資料"
}
```

###### Question Not Found
- **Status Code**: 400 Bad Request
- **Body**:
```json
{
  "error": true,
  "message": "查無相應題目"
}
```

## Additional Information
- All requests are logged
- Successful submissions automatically set member status to ACTIVE
- Answers to basic questions are updated or created for the member
