Get a service map

Get a source's service map for a time range, as the Service map page shows it. The map is drawn from a collector source's metrics, or from a source's traces. Set service to get one node's callers and dependencies.

GET https://telemetry.betterstack.com/api/v4/sources/{source_id}/service-map

URL parameters

source_id
required string

Query parameters

start_time
string
end_time
string
display_mode
DEFAULT services string
depth
integer
service
string
team_id
string

Headers

Authorization
required string
200

Response body

{
  "data": {
    "id": "123456",
    "type": "service_map",
    "attributes": {
      "source_id": "123456",
      "display_mode": "services",
      "nodes": [
        {
          "name": "checkout",
          "kind": "service",
          "platform": "golang",
          "containers": [
            "checkout"
          ],
          "listen_addresses": [
            "172.19.0.12:5050"
          ]
        },
        {
          "name": "orders",
          "kind": "queue",
          "platform": "kafka",
          "containers": [],
          "listen_addresses": []
        }
      ],
      "connections": [
        {
          "source": "checkout",
          "destination": "astronomy-db",
          "destination_address": "172.19.0.14:5432",
          "external": false,
          "protocols": [
            "Postgres"
          ],
          "requests_per_second": 0.041066,
          "server_error_share": 0,
          "client_error_share": 0,
          "duration_p50_ms": 5.0,
          "duration_p95_ms": 5.0,
          "duration_p99_ms": 25.0,
          "duration_p50_lower_bound": null,
          "duration_p95_lower_bound": null,
          "duration_p99_lower_bound": null
        },
        {
          "source": "ad",
          "destination": "flagd",
          "destination_address": "172.19.0.19:8013",
          "external": false,
          "protocols": [
            "HTTP"
          ],
          "requests_per_second": 0.001674,
          "server_error_share": 0.16665,
          "client_error_share": 0,
          "duration_p50_ms": 25.0,
          "duration_p95_ms": 10000.0,
          "duration_p99_ms": 10000.0,
          "duration_p50_lower_bound": null,
          "duration_p95_lower_bound": null,
          "duration_p99_lower_bound": null
        }
      ]
    }
  }
}
401

Response body

{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}
403

Response body

{
  "errors": "You don't have permission to view live tail in this team. Your Better Stack role restricts this action. Ask an organization admin to update your role's permissions."
}
404

Response body

{
  "errors": "Resource with the provided ID was not found"
}
422

Response body

{
  "errors": "Sorry, some values are incorrect",
  "invalid_values": {
    "source_id": "The service map is drawn from a collector source, or from a source whose traces carry the labels the map reads."
  }
}
422

Response attributes

id
string
type
string
source_id
string
display_mode
string
nodes
array of objects
nodes[].name
string
nodes[].kind
string
nodes[].platform
string or null
nodes[].containers
array of strings
nodes[].listen_addresses
array of strings
nodes[].requests_per_second
number or null
nodes[].server_error_share
number or null
nodes[].client_error_share
number or null
nodes[].outbound_requests_per_second
number or null
connections
array of objects
connections[].source
string
connections[].destination
string
connections[].destination_address
string or null
connections[].external
boolean
connections[].protocols
array of strings
connections[].requests_per_second
number or null
connections[].server_error_share
number or null
connections[].client_error_share
number or null
connections[].duration_p50_ms
number or null
connections[].duration_p95_ms
number or null
connections[].duration_p99_ms
number or null
connections[].duration_p50_lower_bound
boolean or null
connections[].duration_p95_lower_bound
boolean or null
connections[].duration_p99_lower_bound
boolean or null

Example cURL

Hosts in the last hour Callers and dependencies of one service
curl --request GET \
  --url "https://telemetry.betterstack.com/api/v4/sources/123456/service-map?display_mode=hosts" \
  --header "Authorization: Bearer $TOKEN"
curl --request GET \
  --url "https://telemetry.betterstack.com/api/v4/sources/123456/service-map?start_time=now-6h&service=checkout" \
  --header "Authorization: Bearer $TOKEN"