API Reference
Calculation
Calculate CPF contributions and projections
Endpoints for calculating CPF contributions for single income, batch scenarios, and multi-year projections.
POST /calculate
Calculate CPF contributions for a single income amount.
Request Body
interface CalculateRequest {
: number; // Required - Monthly gross income (non-negative)
?: string; // Optional - Date in YYYY-MM-DD format (defaults to today)
?: number; // Optional - Age for age-group lookup
}Response
interface CalculateResponse {
: {
: number;
: number;
: number;
};
: {
: number;
: number;
: number;
};
: number;
}Example
curl -X POST https://simplycpf.com/api/cpf/calculate \
-H "Content-Type: application/json" \
-d '{"income": 5000, "age": 30}'{
"contribution": {
"totalContribution": 1850,
"employer": 850,
"employee": 1000
},
"distribution": {
"OA": 1085.5,
"SA": 277.5,
"MA": 487
},
"afterCpfContribution": 4000
}POST /calculate/batch
Calculate CPF contributions for multiple income scenarios (up to 100).
Request Body
interface BatchCalculateRequest {
: <{
: number; // Required - Monthly income
?: string; // Optional - Date in YYYY-MM-DD
?: number; // Optional - Age for age-group lookup
}>;
}Constraints
- Maximum 100 scenarios per request
- Array cannot be empty
Response
Returns an array of ComputedResult objects matching input scenarios.
Example
curl -X POST https://simplycpf.com/api/cpf/calculate/batch \
-H "Content-Type: application/json" \
-d '{"scenarios": [{"income": 4000}, {"income": 6000}, {"income": 8000}]}'POST /projection
Generate multi-year CPF contribution projection with cumulative totals.
Request Body
interface ProjectionRequest {
: number; // Required - Monthly income (non-negative)
: number; // Required - Starting age
: number; // Required - Number of years to project (1-50)
}Constraints
- Maximum 50 years per request
- All fields are required
Response
interface ProjectionResponse {
: { : number; : number; : number };
: <{
: number;
: number;
: string;
: {
: number;
: number;
: number;
};
: {
: number;
: number;
: number;
};
}>;
}Example
curl -X POST https://simplycpf.com/api/cpf/projection \
-H "Content-Type: application/json" \
-d '{"income": 5000, "age": 30, "years": 5}'