> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrubbe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Map Your Services and Calculate Blast Radius

> Register services, define dependencies, and calculate blast radius using the Scrubbe service map API to understand incident impact instantly.

The service map gives you a live graph of your infrastructure — which services exist, how they depend on one another, and what breaks when any one of them fails. During an incident, this graph powers blast radius calculations and downstream impact analysis, letting responders quickly understand the full scope of a failure rather than discovering affected services one by one. This guide walks you through registering services, defining their dependencies, querying the topology, and calculating blast radius.

## Prerequisites

* A valid API key with service map read/write permissions
* Knowledge of your services and their inter-dependencies

***

## Register a service

Add each service to the map with a name, owner, and criticality level. This forms the nodes in your dependency graph.

```bash theme={null}
curl -X POST https://api.scrubbe.io/api/v1/service-map \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "payments-api",
    "description": "Handles payment processing and gateway integration.",
    "owner": "payments-team@example.com",
    "tier": "CRITICAL",
    "environment": "production",
    "region": "us-east-1"
  }'
```

The response includes a service `id`. Store this — you will need it when defining dependencies.

***

## Define dependencies

Tell Scrubbe which services depend on which. A dependency from service A to service B means that a failure in B can affect A.

```bash theme={null}
curl -X POST https://api.scrubbe.io/api/v1/service-map/dependencies \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "serviceId": "<payments-api-id>",
    "dependsOnId": "<redis-cache-id>",
    "type": "HARD",
    "description": "Payments API uses Redis for session and connection pooling."
  }'
```

<Tip>Use `HARD` for dependencies that cause an outage when the upstream fails, and `SOFT` for degraded-but-functional scenarios. Accurate dependency types produce more precise blast radius estimates.</Tip>

***

## View the topology

Retrieve the full dependency graph for your workspace. This is the canonical view of all services and their relationships.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/service-map/topology \
  -H "Authorization: Bearer <token>"
```

The response returns nodes (services) and edges (dependencies) suitable for rendering in a graph visualisation tool.

***

## List and retrieve individual services

<CodeGroup>
  ```bash List all services theme={null}
  curl https://api.scrubbe.io/api/v1/service-map \
    -H "Authorization: Bearer <token>"
  ```

  ```bash Get service by ID theme={null}
  curl https://api.scrubbe.io/api/v1/service-map/<id> \
    -H "Authorization: Bearer <token>"
  ```
</CodeGroup>

***

## Analyse downstream impact

For a specific service, retrieve every downstream service that would be affected if it became unavailable.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/service-map/<id>/downstream-impact \
  -H "Authorization: Bearer <token>"
```

Run this during an incident to immediately understand which other teams need to be notified or which SLAs are at risk.

***

## Update a service

Keep service metadata current as ownership, regions, or criticality tiers change.

```bash theme={null}
curl -X PATCH https://api.scrubbe.io/api/v1/service-map/<id> \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "owner": "new-team@example.com",
    "tier": "HIGH"
  }'
```

***

## Blast radius

The blast radius endpoints quantify the potential impact of a failure, expressed as a percentage of users or transactions affected. Use these during incident triage to prioritise response effort.

<Steps>
  <Step title="Calculate blast radius for a service">
    ```bash theme={null}
    curl -X POST https://api.scrubbe.io/api/v1/blast-radius/calculate \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{
        "serviceId": "<id>"
      }'
    ```

    The response includes an estimated percentage of impacted users and a list of affected downstream services.
  </Step>

  <Step title="Get the current blast radius summary">
    ```bash theme={null}
    curl https://api.scrubbe.io/api/v1/blast-radius \
      -H "Authorization: Bearer <token>"
    ```
  </Step>

  <Step title="Review the risk summary">
    Pull a prioritised view of risk across all services — useful for capacity planning and incident preparedness reviews.

    ```bash theme={null}
    curl https://api.scrubbe.io/api/v1/blast-radius/risk-summary \
      -H "Authorization: Bearer <token>"
    ```
  </Step>
</Steps>

***

## Remove dependencies and services

<Warning>Deleting a service removes it from the topology and severs all of its dependency edges. This will affect blast radius calculations for any service that depended on it.</Warning>

<CodeGroup>
  ```bash Delete a dependency theme={null}
  curl -X DELETE https://api.scrubbe.io/api/v1/service-map/dependencies/<depId> \
    -H "Authorization: Bearer <token>"
  ```

  ```bash Delete a service theme={null}
  curl -X DELETE https://api.scrubbe.io/api/v1/service-map/<id> \
    -H "Authorization: Bearer <token>"
  ```
</CodeGroup>
