---
title: "Calculate RFC"
url: "https://developer.incode.com/api-reference/api-calculate-rfc/"
section: "api-reference"
group: "API validations"
version: "v1.1"
status: "live"
endpoint: "POST /api/calculate/rfc"
---
# 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"
}
```

## Code samples

Generated from this endpoint's method, path, and the conventional Incode headers. The base URL is the Incode demo environment; replace `<YOUR_API_KEY>` with a key for your region.

### cURL

```bash
curl -X POST https://demo-api.incodesmile.com/api/calculate/rfc \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "api-version: 1.0" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "",
    "firstLastName": "",
    "secondLastName": "",
    "birthDate": ""
  }'
```

### Node

```js
const res = await fetch("https://demo-api.incodesmile.com/api/calculate/rfc", {
  method: "POST",
  headers: {
      "x-api-key": "<YOUR_API_KEY>",
      "api-version": "1.0",
      "Content-Type": "application/json",
  },
    body: JSON.stringify({
      "name": "",
      "firstLastName": "",
      "secondLastName": "",
      "birthDate": ""
    }),
});
const data = await res.json();
```

### Python

```python
import requests

headers = {
    "x-api-key": "<YOUR_API_KEY>",
    "api-version": "1.0",
    "Content-Type": "application/json",
}
res = requests.post("https://demo-api.incodesmile.com/api/calculate/rfc", headers=headers, json={
  "name": "",
  "firstLastName": "",
  "secondLastName": "",
  "birthDate": ""
})
data = res.json()
```

### Java

```java
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://demo-api.incodesmile.com/api/calculate/rfc"))
    .header("x-api-key", "<YOUR_API_KEY>")
    .header("api-version", "1.0")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"name\": \"\",\n  \"firstLastName\": \"\",\n  \"secondLastName\": \"\",\n  \"birthDate\": \"\"\n}"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient()
    .send(req, HttpResponse.BodyHandlers.ofString());
```

### Example response

```json
{
  "success": true,
  "status": "OK"
}
```
