---
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 | Default: `1.0` |

## Request body

| 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 |  |  |

### 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 |

### 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 |

## 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 "X-Incode-Hardware-Id: <YOUR_INCODE_HARDWARE_ID>" \
  -H "api-version: 1.0" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "<name>",
    "firstLastName": "<firstLastName>",
    "secondLastName": "<secondLastName>",
    "birthDate": "<birthDate>"
  }'
```

### Node

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

### Python

```python
import requests

headers = {
    "x-api-key": "<YOUR_API_KEY>",
    "X-Incode-Hardware-Id": "<YOUR_INCODE_HARDWARE_ID>",
    "api-version": "1.0",
    "Content-Type": "application/json",
}
res = requests.post("https://demo-api.incodesmile.com/api/calculate/rfc", headers=headers, json={
  "name": "<name>",
  "firstLastName": "<firstLastName>",
  "secondLastName": "<secondLastName>",
  "birthDate": "<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("X-Incode-Hardware-Id", "<YOUR_INCODE_HARDWARE_ID>")
    .header("api-version", "1.0")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"name\": \"<name>\",\n  \"firstLastName\": \"<firstLastName>\",\n  \"secondLastName\": \"<secondLastName>\",\n  \"birthDate\": \"<birthDate>\"\n}"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient()
    .send(req, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```
require "net/http"
require "json"

uri = URI("https://demo-api.incodesmile.com/api/calculate/rfc")
req = Net::HTTP::Post.new(uri)
req["x-api-key"] = "<YOUR_API_KEY>"
req["X-Incode-Hardware-Id"] = "<YOUR_INCODE_HARDWARE_ID>"
req["api-version"] = "1.0"
req["Content-Type"] = "application/json"
req.body = '{
  "name": "<name>",
  "firstLastName": "<firstLastName>",
  "secondLastName": "<secondLastName>",
  "birthDate": "<birthDate>"
}'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)
```

### PHP

```
$ch = curl_init("https://demo-api.incodesmile.com/api/calculate/rfc");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "x-api-key: <YOUR_API_KEY>",
    "X-Incode-Hardware-Id: <YOUR_INCODE_HARDWARE_ID>",
    "api-version: 1.0",
    "Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
  "name": "<name>",
  "firstLastName": "<firstLastName>",
  "secondLastName": "<secondLastName>",
  "birthDate": "<birthDate>"
}');

$data = json_decode(curl_exec($ch), true);
curl_close($ch);
```

### Example response

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