# Lawneu Master Admin API

Live base URL:

```text
https://page.law.indias.cloud/api/v1
```

Master admin panel:

```text
https://app-admin.lawneu.com/
```

Advocate manage panel:

```text
https://page.law.indias.cloud/manage/?advocate_id=1
```

VPS synced deployment:

```text
VPS IP: 187.127.180.29
Project: lawneu-booking
Path: /opt/lawneu-booking
Container: lawneu_app
Compose: /opt/lawneu-booking/docker-compose.yml
```

## Authentication

Use one of these headers for master admin requests:

```text
Authorization: Bearer YOUR_MASTER_KEY
```

or:

```text
X-Master-Key: YOUR_MASTER_KEY
```

Advocate `/manage` requests continue to use:

```text
X-API-KEY: admin_secret_key
```

## Dashboard

```bash
curl "https://page.law.indias.cloud/api/v1/master.php?action=dashboard_stats" \
  -H "X-Master-Key: YOUR_MASTER_KEY"
```

## Postman Collection

Download from zlawpanel or directly:

```text
https://page.law.indias.cloud/LAWNEU_APP_POSTMAN_COLLECTION.json
```

The collection uses placeholders. Set `masterKey` inside Postman before running requests.

## Country And Currency Support

The app APIs now store country and currency wherever payment, case jurisdiction, payouts, receipts, internal calls, or AI drafting need it.
Endpoint value matrix:

| Endpoint | New values |
| --- | --- |
| `POST /advocates/create` | `countryCode`, `countryName`, `state`, `city`, `county`, `defaultCurrency` |
| `POST /advocates/update` | `countryCode`, `countryName`, `state`, `city`, `county`, `defaultCurrency` |
| `GET /advocates`, `GET /cases`, `GET /cases/my-cases` | Filter with `countryCode` and `currencyCode` |
| `POST /cases/initiate` | `countryCode`, `countryName`, `state`, `city`, `county`, `currencyCode` |
| `POST /cases/payment`, `POST /cases/receipts` | `countryCode`, `countryName`, `state`, `city`, `county`, `currencyCode` |
| `POST /payments/initiate`, `GET /payments/status`, `POST /payments/payout` | `countryCode`, `countryName`, `currencyCode`, `currencySymbol` in status responses |
| `POST /ai/generate-draft` | `countryCode`, `countryName` |

Use these fields in create/update payloads:

```json
{
  "countryCode": "IN",
  "countryName": "India",
  "state": "Delhi",
  "city": "New Delhi",
  "county": "Central Delhi",
  "currencyCode": "INR"
}
```

If omitted, APIs inherit from the advocate/case and fall back to `IN`, `India`, and `INR`.

## Advocate-Scoped Email Linkage

The portal settings include an `Internal Mail Access Key`, `Linked Mail Domain`, and mail host details for future Lawneu-wrapped mailbox access.

No direct email endpoint is published in the Postman collection or zlawpanel docs. Lawneu must not expose domain-level mailbox access.

Each advocate website can have one linked mail account in `advocate_mail_accounts`, for example:

```text
adv-sharma.lawneu.in -> adv-sharma@zeetx.com
```

Future mail list/view/reply work must check both:

```text
advocate_id
linked email_address
```

If the requested mailbox is not linked to that advocate website, the request must be rejected. The internal mail key is only a server-side guard for that wrapped flow; it is not a public app credential.

## Advocate Domain Access

Supported advocate subdomain domains:

```text
{subdomain}.lawneu.in
{subdomain}.adv.support
{subdomain}.adv.voto
```

`adv.voto` apex is not routed by the LawNeu booking project. Only subdomains such as `test-advocate.adv.voto` are routed. Do not change `lawneu.com` DNS or the separate `lawneu.com` website project for this flow.

Domain access is enabled by default unless an admin disables a specific domain for an advocate. Disabled domains show only:

```text
Please check your manage app and purchase this link too.
```

### Read domain access for an advocate

```bash
curl "https://page.law.indias.cloud/api/v1/admin.php?action=get_domain_access&advocate_id=1" \
  -H "X-API-KEY: admin_secret_key"
```

### Update multiple domains

```bash
curl -X POST "https://page.law.indias.cloud/api/v1/admin.php?action=update_domain_access&advocate_id=1" \
  -H "X-API-KEY: admin_secret_key" \
  -H "Content-Type: application/json" \
  -d '{"domains":{"lawneu.in":true,"adv.support":false,"adv.voto":true}}'
```

### Update one domain

```bash
curl -X POST "https://page.law.indias.cloud/api/v1/admin.php?action=update_domain_access&advocate_id=1" \
  -H "X-API-KEY: admin_secret_key" \
  -H "Content-Type: application/json" \
  -d '{"domain":"adv.support","is_enabled":false}'
```

## Booking Inbox

### List all inbox threads

```bash
curl "https://page.law.indias.cloud/api/v1/messages.php?action=list" \
  -H "X-Master-Key: YOUR_MASTER_KEY"
```

### Read a single thread

```bash
curl "https://page.law.indias.cloud/api/v1/messages.php?action=read&booking_id=15" \
  -H "X-Master-Key: YOUR_MASTER_KEY"
```

### Reply to client

```bash
curl -X POST "https://page.law.indias.cloud/api/v1/messages.php?action=reply" \
  -H "X-Master-Key: YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"booking_id":15,"message":"Thank you. Our team will contact you shortly."}'
```

## Gallery

### List gallery items for an advocate

```bash
curl "https://page.law.indias.cloud/api/v1/gallery.php?action=list&advocate_id=1" \
  -H "X-Master-Key: YOUR_MASTER_KEY"
```

### Add gallery item

```bash
curl -X POST "https://page.law.indias.cloud/api/v1/gallery.php?action=create" \
  -H "X-Master-Key: YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"advocate_id":1,"title":"Chamber Meeting","image_url":"https://example.com/gallery/chamber.jpg","sort_order":1}'
```

## Legal Requests

### List legal requests

```bash
curl "https://page.law.indias.cloud/api/v1/legal_requests.php?action=list" \
  -H "X-Master-Key: YOUR_MASTER_KEY"
```

### Read legal request

```bash
curl "https://page.law.indias.cloud/api/v1/legal_requests.php?action=read&id=3" \
  -H "X-Master-Key: YOUR_MASTER_KEY"
```

### Accept legal request

```bash
curl -X POST "https://page.law.indias.cloud/api/v1/legal_requests.php?action=accept" \
  -H "X-Master-Key: YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":3,"advocate_mobile":"919999999999","note":"Accepted from zlawpanel"}'
```

Full feature reference:

```text
/LAWNEU_LEGAL_REQUESTS_API.md
```

## AI And Internal P2P Calls

The master portal has a separate `AI / Internal Call Docs` menu. P2P calling is wrapped by the Lawneu app/backend flow and is not published as a direct API or Postman surface.

```text
/LAWNEU_CALL_AI_API.md
```

Configure these from zlawpanel Settings:

```text
p2p_call_mode              auto | audio | video
openwebui_api_enabled      0 | 1
openwebui_base_url         http://open-webui:8080
openwebui_api_key          stored server-side only
openwebui_model            model id, for example llama3.1
openwebui_system_prompt    optional drafting system prompt
```

AI draft endpoint:

```bash
curl -X POST "https://page.law.indias.cloud/api/v1/ai/generate-draft" \
  -H "X-Master-Key: YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"draftType":"LEGAL_NOTICE","statePartiesDetail":"Facts","specificClausesOverride":"Payment demand","countryCode":"IN","countryName":"India"}'
```

## Notes

- Use `https://page.law.indias.cloud/api/v1` for all Lawneu Booking API calls.
- Advocate-side inbox and booking tools stay under `/manage`.
- Master admin should use `https://app-admin.lawneu.com/`.
- `/master/` is no longer needed for the normal workflow.
- Android advocate app endpoint samples are documented in `/LAWNEU_ADVOCATE_APP_API.md`.
- Legal request samples are maintained in `/LAWNEU_LEGAL_REQUESTS_API.md` and the `Legal Request Docs` portal menu.
- AI samples and internal call-flow notes are maintained in `/LAWNEU_CALL_AI_API.md` and the `AI / Internal Call Docs` portal menu.
