# API Reference

Index of HTTP APIs. Detailed contracts live in [services-contracts.md](services-contracts.md). Template: [api-template.md](../templates/api-template.md).

## Core Platform

Base: Core service (`/api/v1`)

| Area | Doc section |
| --- | --- |
| Health | `GET /health` |
| Tenants / Domains / Plans / Features / Subscription / Entitlement check | [services-contracts §5](services-contracts.md) |
| Onboarding & Tenant Context | [services-contracts §7](services-contracts.md) |
| OTP Auth | architecture identity + Core routers `/auth/otp/*` |
| Public tenant site | `GET /api/v1/public/tenant-site` (see contracts updates / Core routers) |

## Identity & Access

Base: Identity service (`/api/v1`)

| Area | Doc section |
| --- | --- |
| OIDC BFF + mobile auth | [services-contracts §8](services-contracts.md) |

## Accounting

Base: Accounting service port `8002` (`/api/v1`)

See service OpenAPI at `/docs` and [phases/Accounting](../phases/Accounting/README.md).

## CRM

Base: CRM service port `8003` (`/api/v1`) — public host `crm.torbatyar.ir`

| Area | Paths |
| --- | --- |
| Leads | `/api/v1/leads` (+ assign/delete/restore) |
| Contacts | `/api/v1/contacts` |
| Organizations | `/api/v1/organizations` |
| Pipelines / stages | `/api/v1/pipelines` |
| Opportunities | `/api/v1/opportunities` (+ `/stage`, `/win`, `/lose`, stage-history) |
| Playbooks / forecasts / goals / targets / win-loss | `/api/v1/playbooks`, `/forecasts`, `/goals`, `/targets`, `/win-loss/*` |
| Activities | `/api/v1/activities` (+ `/complete`, participants, reminders) |
| Tasks / Meetings / Calls | `/api/v1/tasks`, `/meetings`, `/calls` |
| Timeline / Comments / Mentions | `/api/v1/timeline`, `/comments`, `/mentions/*` |
| Bookmarks / Team | `/api/v1/bookmarks`, `/favorites`, `/team-*`, `/collaboration-preferences/{user_id}` |
| Quotes | `/api/v1/quotes` |
| Lookups / tags / addresses / notes / attachments / custom fields / audit | `/api/v1/lookups/*`, `/tags`, `/addresses`, `/notes`, `/attachments`, `/custom-fields`, `/audit` |

Phase docs: [crm-phase-6-0.md](../crm-phase-6-0.md) … [crm-phase-6-3.md](../crm-phase-6-3.md)

## Loyalty

Base: Loyalty service port `8004` (`/api/v1`) — public host `loyalty.torbatyar.ir`

| Area | Paths |
| --- | --- |
| Programs | `/api/v1/programs` (+ soft delete) |
| Tiers | `/api/v1/tiers` (+ soft delete) |
| Members | `/api/v1/members` (+ `/enroll`, `/activate`, `/renew`, `/freeze`, `/resume`, `/cancel`, `/expire`, `/transfer`, `/lifecycle`, soft delete) |
| Point accounts | `/api/v1/point-accounts` (+ soft delete; no balance fields) |
| Rewards | `/api/v1/rewards` (+ soft delete) |
| Campaigns | `/api/v1/campaigns` (+ soft delete) |
| Audit | `/api/v1/audit` |

Phase docs: [loyalty-phase-7-0.md](../loyalty-phase-7-0.md), [loyalty-phase-7-1.md](../loyalty-phase-7-1.md)

## Future Services

Each new module adds an API sheet using the template and links it here.

## Related Documents

- [Services Contracts](services-contracts.md)
- [Authorization Architecture](../architecture/authorization-architecture.md)
- [Event Catalog](event-catalog.md)
