Skip to main content
The ServerInfo API returns metadata about the Cerbos server instance, including its version, commit hash, and build date. This is useful for verifying which version of Cerbos is running and for debugging purposes.

Endpoint

rpc ServerInfo(ServerInfoRequest) returns (ServerInfoResponse)

Request Parameters

This endpoint does not require any parameters.

Response Fields

version
string
The version of the Cerbos server.Example: "0.35.0"
commit
string
The git commit hash of the build.Example: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0"
buildDate
string
The date when the server binary was built.Example: "2024-01-15T10:30:00Z"

Example

curl http://localhost:3592/api/server_info

Use Cases

Health Checks

Use ServerInfo as part of your application’s health check to verify that the Cerbos server is running:
#!/bin/bash
RESPONSE=$(curl -s http://localhost:3592/api/server_info)
if [ $? -eq 0 ]; then
  echo "Cerbos is healthy"
  echo "Version: $(echo $RESPONSE | jq -r '.version')"
else
  echo "Cerbos is not responding"
  exit 1
fi

Version Verification

Verify that your Cerbos instance is running the expected version:
const response = await fetch('http://localhost:3592/api/server_info');
const serverInfo = await response.json();

const requiredVersion = '0.35.0';
if (serverInfo.version !== requiredVersion) {
  console.warn(`Cerbos version mismatch. Expected ${requiredVersion}, got ${serverInfo.version}`);
}

Build Information

Retrieve detailed build information for debugging:
import requests

response = requests.get('http://localhost:3592/api/server_info')
server_info = response.json()

print(f"Cerbos Version: {server_info['version']}")
print(f"Commit: {server_info['commit']}")
print(f"Build Date: {server_info['buildDate']}")

Monitoring and Observability

Include server information in your monitoring and observability platform:
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/cerbos/cerbos-sdk-go/cerbos"
)

func main() {
	c, err := cerbos.New("localhost:3593", cerbos.WithPlaintext())
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()

	info, err := c.ServerInfo(context.Background())
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Cerbos Version: %s\n", info.Version)
	fmt.Printf("Commit: %s\n", info.Commit)
	fmt.Printf("Build Date: %s\n", info.BuildDate)
}

Notes

  • This endpoint does not require authentication by default
  • The endpoint is available on both the HTTP and gRPC interfaces
  • The response format is the same regardless of the request method
  • This is a lightweight endpoint suitable for frequent health checks