# Potential Client User – Store API (cURL & Postman)

## Endpoint
- **Method:** `POST`
- **URL:** `{{BASE_URL}}/api/potential-client-user/potentialClientUserStore`
- **Auth:** JWT required (`jwt.auth`, `check.token`, `dynamic.permission`)

---

## cURL (copy and replace placeholders)

```bash
curl --location 'http://localhost/api/potential-client-user/potentialClientUserStore' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_JWT_TOKEN_HERE' \
--data '{
  "name": "John Doe",
  "email": "john.doe@example.com",
  "phone": "+8801712345678",
  "remark": "Referred by branch manager",
  "reference_id": 1
}'
```

**Replace:**
- `http://localhost` → your app base URL (e.g. `https://your-domain.com`)
- `YOUR_JWT_TOKEN_HERE` → token from login/refresh
- `reference_id` → your integer ID (e.g. branch or agent reference)

**Backend defaults (do not send from frontend):**
- `status` = `LI` (Listed)
- `created_by` = authenticated user's ID from JWT

---

## Postman setup

1. **Method:** POST  
2. **URL:** `http://localhost/api/potential-client-user/potentialClientUserStore` (adjust host)
3. **Headers:**
   - `Content-Type`: `application/json`
   - `Accept`: `application/json`
   - `Authorization`: `Bearer YOUR_JWT_TOKEN_HERE`
4. **Body:** raw → JSON:

```json
{
  "name": "John Doe",
  "email": "john.doe@example.com",
  "phone": "+8801712345678",
  "remark": "Referred by branch manager",
  "reference_id": 1
}
```

**Validation (store):**
- `name`: required, string, max 100
- `email`: required, valid email
- `phone`: required, string, max 20
- `remark`: optional, string, max 255
- `reference_id`: required, integer

**Set by backend (do not send):** `status` = `LI`, `created_by` = JWT user ID

**Success (201):**
```json
{
  "success": true,
  "message": "Potential client user created successfully",
  "data": { "id": 1, "name": "...", "email": "...", ... }
}
```

**Validation error (422):**
```json
{
  "success": false,
  "message": "Validation failed",
  "errors": { "field": ["error message"] }
}
```
