# Step 4 — First Calculation API + Persistence

## Endpoint

`POST /numerology-platform/api/numerology/profile`

## Purpose

This endpoint connects the existing numerology calculation engine to the Step 3 repository layer.

It does not change the MySQL schema and does not duplicate calculation logic.

## Request example

```json
{
  "user_id": 1,
  "first_name": "Ọla",
  "middle_names": "Chike",
  "last_name": "Abdul",
  "birth_date": "1961-08-04",
  "target_year": 2025,
  "target_month": 8,
  "target_day": 14,
  "y_roles": [],
  "birth_time": null,
  "birth_city": null,
  "birth_state": null,
  "birth_country": null
}
```

## Persistence performed

Inside one MySQL transaction, the endpoint saves:

1. `birth_names`
2. `birth_profiles`
3. `numerology_profiles`
4. `missing_number_results`
5. `calculation_runs`

If persistence fails, the transaction is rolled back.

## Methodology

The endpoint uses the existing `book-v1` methodology version already represented in the project database.

## Important security note

Authentication is not implemented by this step. Therefore `user_id` is currently an explicit development input. This endpoint must not be exposed as a production public endpoint until the authentication layer is implemented.

Database credentials remain outside the archive.
