> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/backend-sdk/selphid/release_notes/6.22.0_releasenotes.md).

# 6.22.0

This version adds two new operational metrics endpoints to the Rest Api service, allowing you to monitor the service status (traffic, latency, saturation, SDK health, result quality, and alerts) and integrate it with Prometheus-based monitoring systems.

Optional JWT authentication support is also added to the Rest Api service endpoints. It is disabled by default and is enabled when the service starts.

Additionally, `/api/v1/selphid/health` now responds with `503 Service Unavailable` when the SDK is unavailable, so container probes can detect the failure, and `POST /api/v1/selphid/config` responds with `400 Bad Request`, since the service configuration cannot be modified at runtime.

On the other hand, the minimum glibc version for the on-premise Linux SDK has increased from 2.27 to 2.28, in line with Red Hat 8 systems (glibc 2.28) still in production.

Finally, recognition of the value `Timeout` in the `reason` field in Custom Events completion endpoints has been fixed, as has startup of the license server `selphid-license-server` when its installation path contains spaces.

### Added

* New operational metrics endpoints for the Rest Api service:
  * `/api/v1/selphid/metrics`: JSON snapshot of traffic, latency, saturation, SDK health status, aggregated quality of extractions, facial authentications and passive liveness checks, and active alerts.
  * `/api/v1/selphid/metrics/prometheus`: the same operational status in Prometheus text exposition format.
  * Like `/api/v1/selphid/health` and `/api/v1/selphid/version`, these are public endpoints: they do not require JWT even when authentication is enabled.
  * Configure them at startup with `metrics_enabled` and the classification thresholds `metrics_*`, from `config.json` or using the environment variables `FACEPHI_SELPHID_REST_METRICS_*`. See [Operational metrics](https://docs.facephi.com/docs.facephi-en/sdks/backend-sdk/selphid/installation/installation_instructions_service.md).
* Optional JWT (HS256) authentication support for the Rest Api service endpoints:
  * Disabled by default. Enable it at startup using `config.json` or using the environment variables `FACEPHI_SELPHID_REST_AUTH_*`. See [Environment variables](https://docs.facephi.com/docs.facephi-en/sdks/backend-sdk/selphid/installation/kubernetes_deployment.md#24-variables-de-entorno) and [JWT authentication](https://docs.facephi.com/docs.facephi-en/sdks/backend-sdk/selphid/installation/installation_instructions_service.md).
  * The token is sent in the `Authorization: Bearer <token>` or in a configurable header (by default `x-api-key`), and must include a valid `exp` claim.
  * The endpoints `/api/v1/selphid/health`, `/api/v1/selphid/version`, `/api/v1/selphid/metrics` and `/api/v1/selphid/metrics/prometheus`, and `OPTIONS`, requests are public.

### Changed

* Minimum glibc version for the Linux on-premise SDK: increased from 2.27 to 2.28 (Ubuntu 18.10, Red Hat 8, and compatible systems). Ubuntu 18.04 (glibc 2.27) is no longer supported.
* `/api/v1/selphid/health` returns `503 Service Unavailable` when the SDK is unavailable (previously, `200` it returned `Unhealthy`). Its response `200` now includes the SDK's detailed status (`initialized` and `sdk`).
* `POST /api/v1/selphid/config` always returns `400 Bad Request` (previously, `200` without applying any changes).

### Fixed

* The `Timeout` value of the `reason` field was not recognized by the Custom Events completion endpoints:
  * `/api/v1/selphid/custom-event/authentication/finish`
  * `/api/v1/selphid/custom-event/onboarding/finish`
  * `/api/v1/selphid/custom-event/ocr/finish`
  * `/api/v1/selphid/custom-event/security/finish`
  * `/api/v1/selphid/custom-event/liveness/finish`
  * `/api/v1/selphid/custom-event/voice/authentication/finish`
* The license server `selphid-license-server` could not start when its installation path contained spaces (Windows and Linux).

### API contract updates

Two new endpoints have been added `GET` to the Rest API contract. They are public: they do not require a JWT even when authentication is enabled.

* `/api/v1/selphid/metrics`
* `/api/v1/selphid/metrics/prometheus`

Abbreviated example of the response from `/api/v1/selphid/metrics`:

```json
{
  "schemaVersion": "1.0",
  "timestamp": "2026-10-21T10:00:00Z",
  "service": {
    "name": "facephi-selphid-service",
    "version": "6.22.0",
    "pathBase": "/api/v1/selphid",
    "uptimeSeconds": 3600,
    "configuredThreads": 8
  },
  "state": {
    "initialized": true,
    "classification": "ok",
    "sdk": { "healthy": true, ... }
  },
  "traffic": { "totals": { "requests": 1520, "success": 1500, ... }, "windows": { ... }, "byEndpoint": [ ... ] },
  "latency": { "windows": { "1m": { ... }, "5m": { ... }, "15m": { ... } } },
  "saturation": { "inflight": 1, "configuredThreads": 8, ... },
  "usage": { ... },
  "quality": { ... },
  "alerts": [ ... ]
}
```

The Endpoint `/api/v1/selphid/metrics/prometheus` returns the same operational status in Prometheus text exposition format: first, the service-specific series, with the prefix `facephi_selphid_` (for example, `facephi_selphid_state_classification` or `facephi_selphid_alert_active`), followed by HTTP-level series, such as `facephi_request_success_total`, `facephi_inflight_requests` or `facephi_queue_latency_ms`.

On the other hand, when JWT authentication is enabled, all endpoints except `health`, `version`, `metrics`, `metrics/prometheus` and `OPTIONS` requests require a valid token. If the token is missing or invalid, the service responds with `401 Unauthorized`, with the header `WWW-Authenticate: Bearer`:

```json
{
  "status": 401,
  "error": "Unauthorized",
  "message": "Missing authentication token",
  "timeStamp": "2026-10-21T10:00:00Z"
}
```

`message` indicates the reason: `Missing authentication token`, `JWT token is expired`, `JWT token is not yet valid`, `JWT token does not include exp claim`, `JWT token validation failed` or `Authentication secret is not configured`.

With authentication disabled (the default), the contract of the other endpoints does not change as a result.

The endpoint `/api/v1/selphid/health` changes its response. When the SDK is available, it responds `200` with the SDK's detailed status:

```json
{
  "message": "Healthy",
  "initialized": true,
  "sdk": {
    "healthy": true,
    "initialized": true,
    "lastInitStatus": "OK",
    "lastHealthKnown": true,
    "lastHealthCheckAt": "2026-10-21T10:00:00Z",
    "lastError": ""
  }
}
```

When the SDK is unavailable, it no longer responds `200` with `"message": "Unhealthy"`, but instead `503 Service Unavailable`, with `message` set to `SDK health check failed` or `SelphID SDK is not initialized`:

```json
{
  "status": 503,
  "error": "ServiceUnavailable",
  "message": "SDK health check failed",
  "timeStamp": "2026-10-21T10:00:00Z"
}
```

Finally, `POST /api/v1/selphid/config` no longer responds `200` with `"message": "The configuration has been set."`, since it never applied any changes. It now always responds `400 Bad Request`, with a `message` that indicates the reason: `JWT auth settings are not accessible from the config endpoint` if the body includes JWT authentication keys; an invalid body message if the body is not a JSON object; or `Runtime configuration updates are not supported. Configure the service through config.json or the FACEPHI_SELPHID_REST_* environment variables before starting it` in all other cases.
