# 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; `/balance`, `/ledger`, `/earn`, `/redeem`, `/adjust`, `/expire-points`) |
| Rewards | `/api/v1/rewards` (+ soft delete; `/redeem`, `/redemptions`) |
| Redemptions | `/api/v1/redemptions` (+ `/fulfill`, `/cancel`) |
| Campaigns | `/api/v1/campaigns` (+ soft delete; `/schedule`, `/activate`, `/pause`, `/resume`, `/expire`, `/rules`, `/apply`, `/applications`) |
| Referral programs | `/api/v1/referral-programs` |
| Referral codes | `/api/v1/referral-codes` |
| Referrals | `/api/v1/referrals` (+ `/attribute`, `/convert`, `/reward`, `/cancel`) |
| Wallets | `/api/v1/wallets` (+ `/balance`, `/ledger`, `/credit`, `/debit`, `/adjust`, `/transfer`, soft delete) |
| Audit | `/api/v1/audit` |

Phase docs: [loyalty-phase-7-0.md](../loyalty-phase-7-0.md) … [loyalty-phase-7-6.md](../loyalty-phase-7-6.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)
