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

# Backstage

> Connect Backstage so agents can read your Software Catalog for ownership, dependencies, and metadata gaps, and manage locations through your Approvals

Connect Backstage to let CloudThinker agents read your Software Catalog: which services exist, who owns them, what they depend on, and which entries are missing an owner, lifecycle, repository link, or docs link. The connection uses a **static external access token**, a fixed token you add to your Backstage configuration for one caller. The only change agents can make is to a catalog **location** (the URL of a YAML file Backstage ingests entities from), and each one goes through your workspace's Approvals.

## Prerequisites

* A Backstage instance CloudThinker can reach over `https`. For one behind a firewall, see [Reaching private services](https://docs.cloudthinker.io/guide/connections/overview.md#reaching-private-services).
* Access to your Backstage app configuration and permission to restart Backstage.
* The **Admin** role in the CloudThinker workspace, which you need to add connections. See [Roles](https://docs.cloudthinker.io/guide/security/roles.md).

> [!NOTE]
>
> A workspace holds one Backstage connection. CloudThinker accepts an `http` address only on a [self-hosted deployment](https://docs.cloudthinker.io/guide/deployment/overview.md).

## Setup

**1. Generate a token**

The token can be any string without whitespace that is long enough not to be guessed. One way to make one:

```bash theme={null}
node -p 'require("crypto").randomBytes(24).toString("base64")'
```

Keep it in a secret manager or an environment variable, and use it only for CloudThinker so you can revoke it on its own.

**2. Add it to your Backstage configuration**

Add a `static` entry under `backend.auth.externalAccess`, restricted to the catalog plugin:

```yaml theme={null}
backend:
  auth:
    externalAccess:
      - type: static
        options:
          token: ${CLOUDTHINKER_TOKEN}
          subject: cloudthinker
        accessRestrictions:
          - plugin: catalog
```

Set `CLOUDTHINKER_TOKEN` in the Backstage backend's environment, for example from a Kubernetes secret, before you restart.

`subject` names the caller in Backstage's logs. `plugin: catalog` rejects calls to any other plugin. Without `accessRestrictions`, the token reaches every plugin you run. See [Backstage's service-to-service auth guide](https://backstage.io/docs/auth/service-to-service-auth) for the full options.

**3. Restart Backstage**

Backstage reads external access tokens at startup, so the token works only after a restart. Then test the token and find the URL to enter:

```bash theme={null}
curl -H "Authorization: Bearer $CLOUDTHINKER_TOKEN" \
  "https://backstage.example.com/api/catalog/entities/by-query?limit=1"
```

If the frontend and backend run on different hosts or ports, such as `:7007`, try the backend address. The address that returns JSON, without `/api/...`, is your **Backstage URL**.

**4. Add the connection in CloudThinker**

Open **More → Workspace settings → Connections**, select **Backstage**, and enter:

* **Backstage URL**: the backend root, such as `https://backstage.example.com`
* **Service token**: the token you generated

Click **Connect**.

**Success state:** the connection shows **Connecting** and **Verifying**, then **Connected**. CloudThinker reads one catalog entity to prove the URL and token work.

> [!NOTE]
>
> Enter the root only. Don't add `/api/catalog`, any other path, a query string, a fragment, or credentials. CloudThinker adds the catalog path itself and rejects a URL that carries anything else. It also doesn't follow redirects, so use the address Backstage answers on directly.

## Connection details

| Field | Description | Example |
| - | - | - |
| **Backstage URL** | Backstage backend root over `https`, with no path, query, fragment, or credentials | `https://backstage.example.com` |
| **Service token** | The static external access token from your Backstage configuration, on one line | |

## Required permissions

With `plugin: catalog`, the token can read the whole catalog and also register and remove locations. On a default Backstage instance, only CloudThinker's approval stops those writes, unless you turn on Backstage's permissions framework.

| Restriction on the token | Effect |
| - | - |
| **`plugin: catalog`** | Reaches the Software Catalog only. Set this |
| **No restrictions** | Reaches every plugin in your Backstage instance. Avoid this |

Agents need catalog read access for everything except location changes. Registering, updating, or removing a location also needs catalog create, update, and delete access on locations.

> [!WARNING]
>
> Backstage's `permission` and `permissionAttribute` restrictions work only when the permissions framework is on, and it's off by default. Until then, the `plugin` restriction is the only limit Backstage itself enforces.

## Agent capabilities

| Capability | What agents can do | Approval |
| - | - | - |
| **Catalog overview** | Summarize entities by kind, type, owner, namespace, system, and domain. Reads 15 entities by default, 50 at most | No |
| **Metadata gaps** | Count entities missing an owner, lifecycle, source repository link, or documentation link, within the same 15 to 50 entities | No |
| **Service context** | For one named entity: owner, lifecycle, system, domain, source repository, docs, APIs, dependencies, and relations | No |
| **Location lookup** | Read one registered catalog location by ID | No |
| **Location changes** | Register a location, point an existing one at a new target, or remove one | Yes |

Answers are bounded, so agents say "returned 15" rather than "15 exist". For a large catalog, ask about one named entity, which reads that entity's full context. A missing owner means nobody filled in that field in Backstage, not that the service has no owner, and agents report it that way.

### Verify the connection

```text theme={null}
Summarize our Backstage catalog: which kinds of entities it has and who owns them
```

Expect a breakdown by kind and owner, a count of entries missing key metadata, and a note on how many entities the answer covers.

### Example prompts

```text theme={null}
Which components in Backstage have no owner set?
What are the owner, system, and dependencies of the payments-api component?
Which Backstage entries are missing a documentation link, and which should we fix first?
```

## Location changes

Agents can't create, edit, or delete catalog entities. Entities come from the locations Backstage ingests, so you edit them at the source. The one write this connection makes is to a location, and each one goes through [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md).

Every change an agent makes goes through your workspace's [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md) first. On the default **Auto · Rules + AI · Ask me** mode, AI judgment can let a safe change run without asking — and an Allow Rule can too, once CloudThinker turns on [Rule enforcement](https://docs.cloudthinker.io/guide/approvals/rules.md#troubleshooting) for your workspace. Choose **Manual** to approve every change yourself.

To be asked about every location change, choose **Manual**, or turn off **Allow writes** on the connection's detail panel to block them outright. Once CloudThinker turns on [Rule enforcement](https://docs.cloudthinker.io/guide/approvals/rules.md#troubleshooting) for your workspace, an **Ask first** [Rule](https://docs.cloudthinker.io/guide/approvals/rules.md) can cover the Backstage connection on its own.

Before it requests approval, the agent states the action, the location ID or target URL, and the URL prefix it treats as yours, such as `https://github.com/acme/catalog/`. There's no setting for this prefix: the agent takes it from your request, so name it in your prompt and check it in the approval. Two rules limit what an approval can do:

* The new target must be an `https` URL under the approved prefix. Anything else is refused before a request is sent.
* Updating or removing a location first reads its current target and checks it's under the same prefix, so an approval can't touch another team's location.

> [!WARNING]
>
> Removing a location removes the entities it produced from your catalog. Read the target in the request before you approve.

## Troubleshooting

> [accordion] Failed to connect to Backstage
>
> CloudThinker shows this one message for every connection failure. Check in this order:
>
> * The URL is the backend root and doesn't redirect.
> * The token is in `backend.auth.externalAccess`, matches exactly, and Backstage was restarted after you added it.
> * `accessRestrictions` includes `plugin: catalog`.
> * Backstage is reachable from CloudThinker.

> [accordion] Invalid Backstage URL, or Invalid Backstage connection configuration
>
> The URL has a path, query, fragment, or credentials, or the token is empty or contains a line break. Enter the plain root and paste the token as one line with no quotes.

> [accordion] Backstage URL must use HTTPS outside local development
>
> The URL starts with `http://`. Despite the wording, `http` is also accepted on a [self-hosted deployment](https://docs.cloudthinker.io/guide/deployment/overview.md) of CloudThinker. On CloudThinker Cloud, serve Backstage over `https`.

> [accordion] The agent reports fewer entities than Backstage shows
>
> An overview reads at most 50 entities. Ask about one named entity instead of the whole catalog.

> [accordion] An agent says it can't edit a catalog entity
>
> That's expected, and no permission changes it. Edit the entity's YAML at its source. An agent can register, repoint, or remove the location for you, through your Approvals.

> [accordion] Updating a location fails
>
> Your Backstage release can't update a catalog location in place. Ask the agent to remove the location and register the new target instead.

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- **Restrict the token to the catalog**: one `plugin: catalog` line keeps it from reaching every other plugin you run.
- **Rotate by replacing the entry**: a static token never expires on its own. Replace it in your Backstage configuration and restart. A workspace holds one Backstage connection, so there's no pencil icon to edit it. Open **More → Workspace settings → Connections**, select **Backstage**, click **Disconnect**, then connect again with the new **Service token**. Discovery runs again and **Allow writes** goes back to on. See [Rotate a credential](https://docs.cloudthinker.io/guide/connections/overview.md#rotate-a-credential).

## Related

> [card] [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md)
>
> Decide which location changes run, wait for a person, or are refused.

> [card] [Connections](https://docs.cloudthinker.io/guide/connections/overview.md)
>
> See every service you can connect and how connection status works.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.