Skip to content

API

A running service serves interactive OpenAPI documentation at /docs and the schema at /openapi.json. A generated copy of the schema is in the repository at api/openapi.json.

Read endpoints are public. Write endpoints need a signed-in, allow-listed session. See authentication.

Health and configuration

GET /health
GET /api/v1/config

Topology

GET /api/v1/topology
GET /api/v1/topics/orders.v1/flow

Metrics

GET /api/v1/metrics/latest?tenantId=demo
GET /api/v1/metrics/history?tenantId=demo&entityIri=...&metricName=...
GET /api/v1/anomalies?tenantId=demo

history also takes start, end and limit. Without start and end it returns the last 24 hours.

Question router

POST /api/v1/query
Content-Type: application/json

{
  "question": "What is the blast radius of `orders.v1`?",
  "tenantId": "demo"
}

The router matches keywords and runs one of four operations. The response carries the chosen intent:

Intent Triggered by Returns
topology topology, graph, servers, clusters node and relationship counts and the full topology
consumer_lag lag, falling behind, consumer delay the latest consumer lag series
anomalies anomaly, problem, issue, risk, critical current threshold violations
topic_flow a topic name, or producer, consumer, blast radius, depends producers, consumers and resources within three hops of the topic
help anything else a list of what the router can answer

SPARQL

POST /api/v1/sparql
Content-Type: application/json

{
  "query": "PREFIX bf: <https://blackfox.io/ontology/core#> SELECT ?s WHERE { GRAPH <https://blackfox.io/graph/demo/prod/current> { ?s a bf:Topic } }"
}

Only SELECT and ASK are accepted. Updates, SERVICE, FROM and FROM NAMED return 400. Select a graph with a GRAPH pattern. The response uses the SPARQL 1.1 JSON results format.

Observation ingestion

Requires a session.

POST /api/v1/observations
Content-Type: application/json

{
  "tenantId": "demo",
  "environmentId": "prod",
  "collectorType": "kafka-admin",
  "collectorInstance": "collector-1",
  "resource": {
    "type": "Topic",
    "externalId": "orders.v2",
    "label": "orders.v2"
  },
  "attributes": {
    "partitionCount": 24,
    "replicationFactor": 3
  },
  "relationships": [
    {
      "type": "belongs_to_cluster",
      "target": {
        "type": "KafkaCluster",
        "externalId": "production-eu",
        "label": "production-eu"
      },
      "confidence": 1.0,
      "evidenceSource": "Kafka Admin API"
    }
  ],
  "metrics": [
    {
      "name": "kafka.topic.bytes.in_per_second",
      "value": 1450000,
      "unit": "bytes/s"
    }
  ]
}

The response gives the observation IRI, the resource IRI, the relationship targets and the number of metrics written.

POST /api/v1/demo/metric writes one metric sample and exists for the demo generator. It also requires a session.

Sign-in routes

GET  /auth/me
GET  /auth/github/login
GET  /auth/github/callback
POST /auth/logout
POST /auth/dev-login

/auth/dev-login returns 404 unless AUTH_DEV_LOGIN=true.