Skip to main content

Overview

The health check endpoint verifies connectivity to the SIFEN service by performing a lightweight RUC consultation. This endpoint is essential for monitoring, alerting systems, and readiness checks.
Best Practice: Configure your monitoring system to poll this endpoint every 30-60 seconds. Alert on consecutive failures (e.g., 3+ failures) to avoid false positives from transient network issues.

Endpoint

GET /health/sifen/prod

Path Parameters

env
string
required
Target environment for health check
  • prod - Production SIFEN environment
  • test - Test SIFEN environment

Query Parameters

emisor
string
Optional taxpayer RUC for environment-specific health checks. If not provided, a random test RUC is used.

Response

Success Response (UP)

Returns HTTP 200 when SIFEN service is reachable and responding normally.
status
string
Service status: UP or DOWN
ambiente
string
Environment checked (prod or test)
httpStatus
integer
HTTP status code from SIFEN service response
timestamp
string
ISO 8601 timestamp of the health check

Failure Response (DOWN)

Returns HTTP 503 when SIFEN service is unreachable or experiencing issues.

Status Codes

CodeStatusDescription
200UPSIFEN service is healthy and responding
503DOWNSIFEN service is unavailable or not responding properly

Examples

Check Production Environment

curl -X GET "https://api.jsifen.com/health/sifen/prod"

Check Test Environment

curl -X GET "https://api.jsifen.com/health/sifen/test"

Check with Specific Emisor

curl -X GET "https://api.jsifen.com/health/sifen/prod?emisor=80012345-6"

Use Cases

1. Kubernetes Readiness Probe

readinessProbe:
  httpGet:
    path: /health/sifen/prod
    port: 8080
  initialDelaySeconds: 10
  periodSeconds: 30
  timeoutSeconds: 5
  failureThreshold: 3

2. Monitoring Dashboard

Use this endpoint to track SIFEN uptime across environments:
# Production uptime check
curl -f https://api.jsifen.com/health/sifen/prod || echo "SIFEN Production DOWN"

# Test environment check
curl -f https://api.jsifen.com/health/sifen/test || echo "SIFEN Test DOWN"

3. Pre-flight Validation

Before processing critical operations, verify SIFEN availability:
async function checkSifenAvailability() {
  const response = await fetch('https://api.jsifen.com/health/sifen/prod');
  const health = await response.json();
  
  if (health.status !== 'UP') {
    throw new Error(`SIFEN unavailable: ${health.httpStatus}`);
  }
  
  return true;
}

Health Check Logic

The endpoint performs a lightweight RUC consultation to verify SIFEN connectivity:
  1. Generates a random test RUC (or uses provided emisor)
  2. Performs RUC query against SIFEN service
  3. Evaluates HTTP response code:
    • UP: HTTP status 200-499 (service responding)
    • DOWN: HTTP status 500+ or network failure
The health check uses responses in the 200-499 range as “UP” because even error responses (like 404 or 400) indicate the SIFEN service is reachable and processing requests.

Additional Resources

For production monitoring setup, see the Deployment Guide.

Build docs developers (and LLMs) love