# New Line Quick Add — API Documentation

Create a new line (connection) request quickly with just the customer's **name** and **mobile number**.

---

## Endpoint

| | |
|---|---|
| **Method** | `POST` |
| **URL** | `https://billing.circlenetworkbd.net/api/new-line-req-quick-add` |
| **Auth** | None (public endpoint) |
| **Content-Type** | `application/x-www-form-urlencoded` or `application/json` |

---

## Request Parameters

| Field | Type | Required | Rule | Description |
|-------|------|----------|------|-------------|
| `name` | string | ✅ Yes | required | Customer full name |
| `phone` | string | ✅ Yes | exactly 11 digits | Customer mobile number (e.g. `01712345678`) |

**Notes**
- Only `name` and `phone` are accepted. The request **source** is assigned automatically by the system — you do **not** send it.
- `phone` must be **exactly 11 digits** (numbers only, no `+`, spaces, or dashes).

---

## Example Request

### cURL
```bash
curl -X POST "https://billing.circlenetworkbd.net/api/new-line-req-quick-add" \
  -H "Accept: application/json" \
  -d "name=Rahim Uddin" \
  -d "phone=01712345678"
```

### JSON body
```http
POST /api/new-line-req-quick-add HTTP/1.1
Host: billing.circlenetworkbd.net
Content-Type: application/json
Accept: application/json

{
  "name": "Rahim Uddin",
  "phone": "01712345678"
}
```

---

## Responses

All responses are returned with HTTP status `200` and a JSON body containing an `error` flag.
**Always check the `error` field**, not the HTTP status.

### ✅ Success
```json
{
  "error": false,
  "message": "Data saved successfully"
}
```
> The `message` text is configurable on the server, so it may differ.

### ❌ Validation error (missing/invalid fields)
```json
{
  "error": true,
  "message": {
    "name": ["The name field is required."],
    "phone": ["The phone must be 11 digits."]
  }
}
```

### ❌ Duplicate request (same number within 24 hours)
```json
{
  "error": true,
  "message": {
    "already_exist": "Your are already applied for new line. Please try after 24 hour."
  }
}
```

---

## Business Rules

1. **Duplicate protection:** The same `phone` number can only submit **once per day**. A second request with the same number on the same calendar day is rejected with the `already_exist` message.
2. **Source:** Every request created through this endpoint is tagged with a fixed internal source.
3. **Status:** The request is created with an internal status of *quick request* and then processed by the operations team inside the panel.

---

## Quick Integration Checklist

- [ ] Send a `POST` request to `/api/new-line-req-quick-add`.
- [ ] Include `name` and `phone` (11 digits).
- [ ] Read the JSON response and check `error`:
  - `error: false` → success, show the `message`.
  - `error: true` → show the validation/duplicate `message` to the user.
- [ ] Do not resend the same number within 24 hours.
