The Takaful module handles Shariah-compliant mutual insurance : users contribute periodically to a pool, then may submit a claim when certain events occur (death, critical illness, disability, natural disaster). The TakafulController at /takaful combines two primary resources: contributions (CRUD + list) and claims (submit, list, admin review, payout, and pool stats). Review/payout are restricted to @Roles(UserType.MORIA).
Property Value Base URL {HOST}/v1Auth Bearer JWT (header Authorization) or cookie access_token Content-Type application/jsonError envelope { "message": string | string[], "statusCode": number, "error": string }Validation Global ValidationPipe · whitelist: true, forbidNonWhitelisted: true · unknown field → 400 Related modules pools, users, organizations, payments Document version v1 · 2026-05-20 Audience Internal FE devs (mobile + web)
An INDIVIDUAL user creates a contribution via POST /takaful/contributions and can list / view detail of their own. When an incident occurs, the user submits a claim via POST /takaful/claims with a reason category. MORIA admin reviews (approve/reject) via PATCH /takaful/claims/:id/review; after approval, payout is disbursed via POST /takaful/claims/:id/payout. Pool stats are available to admins at GET /takaful/pools/:pool_id/stats.
Method Path Auth Summary GET /v1/takaful/contributionsbearer List contributions (own or by organization) GET /v1/takaful/contributions/:idbearer Contribution detail POST /v1/takaful/contributionsbearer Create new contribution GET /v1/takaful/claimsbearer List claims (own or by org) GET /v1/takaful/claims/:idbearer Claim detail POST /v1/takaful/claimsbearer Submit new claim PATCH /v1/takaful/claims/:id/reviewbearer MORIA admin reviews claim (approve/reject) POST /v1/takaful/claims/:id/payoutbearer MORIA admin processes payout GET /v1/takaful/pools/:pool_id/statsbearer MORIA admin: pool statistics
Auth + scope notes
All endpoints require a Bearer JWT plus the appropriate permission.
INDIVIDUAL can only access their own contribution/claim.
ORGANIZATION /MORIA admins can pass the organization_id query (for contributions) or orgId query (for claims) to list within an organization’s scope.
Claim review, payout, and pool stats endpoints are restricted to @Roles(UserType.MORIA) — platform superadmin only.
Claim categories: death, critical_illness, disability, natural_disaster.
List takaful contributions. INDIVIDUAL is automatically scoped to their own; ORGANIZATION/MORIA admins use the organization_id query to filter to a specific org.
bearer
read-takaful
RESOURCE_FETCHED
Param Type Default Notes organization_idUUID optional Filter by org (for admins); ignored if caller is INDIVIDUAL
"message" : " Takaful contributions retrieved successfully " ,
"id" : " 550e8400-e29b-41d4-a716-446655440000 " ,
"user_id" : " 770e8400-e29b-41d4-a716-446655440222 " ,
"pool_id" : " 660e8400-e29b-41d4-a716-446655440111 " ,
"period_start" : " 2026-02-01 " ,
"period_end" : " 2026-03-01 " ,
"payment_ref" : " PAY-20260201-001 " ,
"created_at" : " 2026-02-01T08:30:00.000Z "
Status When it occurs 400 Bad RequestOrganization ID or query param invalid 401 UnauthorizedBearer/cookie token invalid 403 ForbiddenPermission insufficient
Detail of a single takaful contribution.
bearer
read-takaful
RESOURCE_FETCHED
Param Type Notes idUUID Contribution ID — validated by ParseUUIDPipe
"message" : " Takaful contribution retrieved successfully " ,
"id" : " 550e8400-e29b-41d4-a716-446655440000 " ,
"user_id" : " 770e8400-e29b-41d4-a716-446655440222 " ,
"pool_id" : " 660e8400-e29b-41d4-a716-446655440111 " ,
"period_start" : " 2026-02-01 " ,
"period_end" : " 2026-03-01 " ,
"payment_ref" : " PAY-20260201-001 " ,
Status When it occurs 400 Bad Requestid is not a UUID401 UnauthorizedBearer/cookie token invalid 403 ForbiddenPermission insufficient 404 Not FoundContribution not found
Create a new takaful contribution to an organization’s pool. The contribution period is set explicitly via period_start / period_end.
bearer
create-takaful
CONTRIBUTION_MADE
Field Type Required Notes organization_idUUID yes Target pool organization amountnumeric string yes Contribution amount (IsNumberString) period_startstring (YYYY-MM-DD) yes Period start date period_endstring (YYYY-MM-DD) yes Period end date payment_refstring optional Payment reference
"organization_id" : " be2cb7da-e217-401c-8d07-b01e64adfb34 " ,
"period_start" : " 2025-02-01 " ,
"period_end" : " 2025-03-01 " ,
"payment_ref" : " PAY-20250201-001 "
"message" : " Takaful contribution created successfully " ,
"data" : { "contribution" : { "..." : " TakafulContributions shape " } }
Status When it occurs 400 Bad RequestValidation failed (UUID/format) 401 UnauthorizedBearer/cookie token invalid 403 ForbiddenPermission insufficient
Emits BusinessEvent CONTRIBUTION_MADE (impact MEDIUM).
Balance is moved to the organization’s takaful pool.
List takaful claims. INDIVIDUAL is automatically scoped to their own claims; ORGANIZATION/MORIA admins use the orgId query (note: param name here is camelCase, differing from the contributions endpoint).
bearer
read-takaful-claims
RESOURCE_FETCHED
Param Type Default Notes orgIdUUID optional Filter by org (for admins); ignored if caller is INDIVIDUAL
"message" : " Takaful claims retrieved successfully " ,
"id" : " 550e8400-e29b-41d4-a716-446655440000 " ,
"contribution_id" : " 660e8400-e29b-41d4-a716-446655440111 " ,
"user_id" : " 770e8400-e29b-41d4-a716-446655440222 " ,
"pool_id" : " 880e8400-e29b-41d4-a716-446655440333 " ,
"claim_amount" : " 5000.0000 " ,
"reason" : " Medical emergency requiring treatment " ,
"claim_reason" : " critical_illness " ,
"created_at" : " 2026-02-15T10:00:00.000Z "
Status When it occurs 400 Bad RequestorgId invalid401 UnauthorizedBearer/cookie token invalid 403 ForbiddenPermission insufficient
Detail of a single takaful claim.
bearer
read-takaful-claims
RESOURCE_FETCHED
Param Type Notes idUUID Claim ID
"message" : " Takaful claim retrieved successfully " ,
"claim" : { "..." : " TakafulClaims shape " }
Status When it occurs 400 Bad Requestid is not a UUID401 UnauthorizedBearer/cookie token invalid 403 ForbiddenPermission insufficient 404 Not FoundClaim not found
Submit a takaful claim against a contribution. Valid values for claim_reason: death, critical_illness, disability, natural_disaster.
bearer
create-takaful-claims
RESOURCE_CREATED
Field Type Required Notes contribution_idUUID yes Contribution that the claim is based on claim_amountnumeric string yes Requested amount reasonstring yes Free-text reason detail claim_reasonenum TakafulClaimReason yes death, critical_illness, disability, natural_disaster
"contribution_id" : " be2cb7da-e217-401c-8d07-b01e64adfb34 " ,
"claim_amount" : " 5000.00 " ,
"reason" : " Medical emergency requiring treatment " ,
"claim_reason" : " critical_illness "
"message" : " Takaful claim submitted successfully " ,
"id" : " 550e8400-e29b-41d4-a716-446655440000 " ,
"contribution_id" : " be2cb7da-e217-401c-8d07-b01e64adfb34 " ,
"claim_amount" : " 5000.0000 " ,
"claim_reason" : " critical_illness " ,
Status When it occurs 400 Bad RequestValidation failed (UUID/format/enum) 401 UnauthorizedBearer/cookie token invalid 403 ForbiddenPermission insufficient
MORIA admin reviews a claim: approve (with approved_amount) or reject. After approval, payout can be triggered via a separate endpoint.
bearer
MORIA
update-takaful-claims
RESOURCE_UPDATED
Param Type Notes idUUID Claim ID
Field Type Required Notes action'approve' | 'reject'yes Review action approved_amountnumeric string optional Approved amount (required when action=approve)
"approved_amount" : " 5000.00 "
"message" : " Takaful claim reviewed successfully " ,
"id" : " 550e8400-e29b-41d4-a716-446655440000 " ,
"approved_amount" : " 5000.0000 " ,
"reviewed_by" : " 880e8400-e29b-41d4-a716-446655440444 " ,
"reviewed_at" : " 2026-02-20T10:00:00.000Z "
Status When it occurs 400 Bad RequestValidation failed · approved_amount missing on approve 401 UnauthorizedBearer/cookie token invalid 403 ForbiddenRole not MORIA 404 Not FoundClaim not found
MORIA admin processes payout for an approved claim. Funds are moved from the takaful pool to the recipient account and the claim status changes to paid.
bearer
MORIA
payout-takaful-claims
WITHDRAWAL_PROCESSED
Param Type Notes idUUID Claim ID
"message" : " Takaful payout processed successfully " ,
"payout" : { "amount" : " 500.00 " , "reference" : " PAYOUT-20250201-001 " }
Status When it occurs 400 Bad RequestInvalid payout (claim not approved, etc.) 401 UnauthorizedBearer/cookie token invalid 403 ForbiddenRole not MORIA 404 Not FoundClaim not found
Claim status → paid.
Takaful pool balance is reduced by approved_amount.
Emits BusinessEvent WITHDRAWAL_PROCESSED (impact CRITICAL).
MORIA admin: takaful pool statistics — total contributions, total claims, total payouts, and other metrics.
bearer
MORIA
read-takaful-claims
RESOURCE_FETCHED
Param Type Notes pool_idUUID Takaful pool ID
"message" : " Takaful pool statistics retrieved successfully " ,
"total_contributions" : " 10000.00 " ,
"total_payouts" : " 2500.00 "
Status When it occurs 400 Bad Requestpool_id is not a UUID401 UnauthorizedBearer/cookie token invalid 403 ForbiddenRole not MORIA 404 Not FoundPool not found
active — contribution active within the period
expired — period has elapsed
cancelled — cancelled
submitted — claim newly submitted
under_review — admin is reviewing
approved — claim approved, awaiting payout
rejected — claim rejected
paid — payout executed
death — participant death
critical_illness — critical illness
disability — disability
natural_disaster — natural disaster
"message" : " Claim not found " ,
message may be a string or array of strings (multi-field validation errors).
400 body/query/param validation
401 token expired / missing
403 permission insufficient · role not MORIA
404 contribution/claim/pool not found
500 internal — show a generic toast
List contributions: ?organization_id=<uuid>
List claims: ?orgId=<uuid> (camelCase, different)