Skip to content

API client

The xrelia API can be accessed directly over HTTP, but for most applications we recommend using one of the official xrelia API clients. The API client handles authentication, request formatting, payload validation, and communication with the xrelia API, allowing you to focus on collecting and sending reliability data.

Currently, official API clients are available for:

Go JavaScript Python

Additional language support will be added over time.

All API clients use the same authentication mechanism.

Before creating a client, export your API key as the XRELIA_API_KEY environment variable.

export XRELIA_API_KEY="<YOUR_API_KEY>"

The client automatically reads the API key from the environment and generates the required authentication headers for every request.

Metric samples allow you to push custom application, infrastructure, or business metrics into xrelia.

The following example sends two metric samples for the same metric.

push_metrics.go
metrics := protocol.NewMetrics()
metrics.AddSample(protocol.MetricSample{
ID: "CPU_METRIC_ID",
Val: 25.5,
TS: time.Now().Unix(),
})
metrics.AddSample(protocol.MetricSample{
ID: "CPU_METRIC_ID",
Val: 27.8,
})
if err := client.SendMetrics(
"PLATFORM_ID",
"INSTANCE_ID",
metrics,
); err != nil {
logger.Error(err.Error())
}

Metric samples are automatically batched and submitted to the xrelia metrics API.

Synthetic requests allow you to track the health of critical user journeys and application workflows.

Examples include:

  • User login
  • Checkout process
  • Account registration
  • Payment processing
  • API transactions

The following example submits two synthetic request results.

push_user_journey.go
userJourney := protocol.NewUserJourney()
userJourney.AddSyntheticRequestResult(protocol.SyntheticRequestResult{
ID: "LOGIN_REQUEST_ID",
TS: time.Now().Unix(),
Status: 0,
})
userJourney.AddSyntheticRequestResult(protocol.SyntheticRequestResult{
ID: "LOGIN_REQUEST_ID",
TS: time.Now().Unix(),
Status: 100,
})
if err := client.SendUserJourney(
"PLATFORM_ID",
"INSTANCE_ID",
userJourney,
); err != nil {
logger.Error(err.Error())
}

Each synthetic request result records the outcome of a monitored user action and contributes to the overall health and confidence score of the associated service.

All API operations require:

  • platformId
  • instanceId

These identifiers determine where incoming data is stored and analyzed within xrelia.

You can find both values in the xrelia Console on the Service Instance overview page.

In addition to metrics and synthetic requests, the API clients also support:

  • Dependency health reporting
  • Deployment tracking
  • Configuration change tracking

These capabilities allow xrelia to correlate operational events with service health and provide richer reliability insights.

Refer to the language-specific SDK documentation for complete examples and API reference information.