> ## Documentation index
> Fetch the complete documentation index at: https://docs.simplycpf.com/llms.txt
> Ask it with GET https://docs.simplycpf.com/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.

# Getting Started

> Learn how to use the SimplyCPF API

This guide will help you get started with the SimplyCPF API.

## Prerequisites

No authentication is required. All endpoints are publicly accessible.

## Making Your First Request

### Using curl

```bash
curl https://simplycpf.com/api/cpf/age-groups
```

### Using JavaScript/TypeScript

```typescript
const response = await fetch(
  "https://simplycpf.com/api/cpf/calculate",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ income: 5000, age: 30 }),
  }
);

const data = await response.json();
console.log(data);
```

### Using Python

```python
import requests

response = requests.post(
    "https://simplycpf.com/api/cpf/calculate",
    json={"income": 5000, "age": 30}
)

data = response.json()
print(data)
```

## Response Format

All successful responses return JSON with the following structure:

```json
{
  "contribution": {
    "employee": 1000,
    "employer": 850,
    "totalContribution": 1850
  },
  "distribution": {
    "OA": 1150.14,
    "SA": 299.88,
    "MA": 399.97
  },
  "afterCpfContribution": 4000
}
```

## Error Handling

When an error occurs, the API returns an appropriate HTTP status code with an error message:

```json
{
  "error": "Income must be a non-negative number"
}
```

### Common Status Codes

| Status | Description |
|--------|-------------|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 429 | Too Many Requests - Rate limit exceeded |
| 404 | Not Found - Endpoint does not exist |
| 500 | Internal Server Error |

## Rate Limits

Production CPF API endpoints are limited to **10 requests per 10 seconds per client IP**. If you exceed the limit, the API returns HTTP `429`:

```json
{
  "error": "Rate limit exceeded"
}
```

Back off and retry after the current 10-second window before sending more requests.

## Next Steps

- Explore the [API Reference](/api) for detailed endpoint documentation
- Check out [Examples](/examples) for common use cases
- View the [Changelog](/changelog) for recent updates
