# Calculate RFC

`POST /api/calculate/rfc`

Base URL: `https://demo-api.incodesmile.com` — Incode demo environment

Calculate and return the RFC based on a person data.

Once you obtain the calculated RFC it doesn't necessarily mean it's a valid one. You could use the validate RFC method to check if it exists.

## Path & query parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `api-version` | header | string | yes |  |

## Request body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `firstLastName` | string | yes |  |
| `secondLastName` | string | yes |  |
| `birthDate` | string (dd/mm/yyyy) | yes |  |

## Responses

### 200

Successfully calculated RFC

Response body (`application/json`):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `calculatedRFC` | string |  |  |

```json
{
  "calculatedRFC": "PEPJ870918ABC"
}
```

### 400

Invalid input data

Response body (`application/json`):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `timestamp` | integer (int64) |  | UTC timestamp in milliseconds |
| `status` | integer (int32) |  | Custom error code or HTTP status code |
| `error` | string |  | HTTP status error |
| `message` | string |  | Custom error message |
| `path` | string |  | Endpoint path |
| `details` | object |  | Custom error details |

```json
{
  "timestamp": 1622548800000,
  "status": 400,
  "error": "Bad Request",
  "message": "Date is not in valid format",
  "path": "/api/calculate/rfc",
  "details": {
    "error": {
      "birthDate": [
        "Birth date must be in format dd/mm/yyyy"
      ]
    }
  }
}
```

### 500

Internal server error during calculation

Response body (`application/json`):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `timestamp` | integer (int64) |  | UTC timestamp in milliseconds |
| `status` | integer (int32) |  | Custom error code or HTTP status code |
| `error` | string |  | HTTP status error |
| `message` | string |  | Custom error message |
| `path` | string |  | Endpoint path |
| `details` | object |  | Custom error details |

```json
{
  "timestamp": 1622548800000,
  "status": 500,
  "error": "Internal Server Error",
  "message": "Error calculating RFC",
  "path": "/api/calculate/rfc"
}
```
