Skip to main content
In this lesson you’ll learn how to model an API in Backstage’s Software Catalog and how to link that API with the components that provide and consume it. We’ll use an authentication service (auth-service) that provides an API (auth-api) and show how a consumer component (for example, shopping-cart) can declare it consumes that API. Existing component entity for the authentication service (already imported into Backstage):
Why use a separate API entity?
  • Separating the API into its own API entity lets Backstage display API docs, ownership, and relationships independently of implementation.
  • It enables discoverability: teams can find APIs and see providers and consumers in the relations graph.
Ways to link Component and API
  • Reference the provider from the API entity using spec.apiProvidedBy.
  • Reference the API from the provider Component using spec.providesApis (a list).
  • Both approaches are valid; choose what fits your workflow.
Comparison Example: API entity that references the provider via apiProvidedBy and embeds an inline OpenAPI definition (shortened for clarity):
Alternatively, declare the API on the provider component using providesApis:
This associates auth-service with the auth-api API entity shown earlier. Note: the definition field must follow the format described by spec.type (for openapi, that means supplying an OpenAPI document). For more details, consult the Software Catalog descriptor docs:
A screenshot of the Backstage documentation page for the Software Catalog YAML file format, showing the left navigation menu, main content describing spec.system/spec.definition and relation tables, and a right-hand table of contents. The browser window has multiple tabs open and the system taskbar is visible at the bottom.
Viewing relations in the Backstage UI
  • After creating an API entity and linking it to auth-service, the API details page will show relations such as auth-service -> auth-api.
  • Relations make it easy to see ownership and IoC (who provides and who consumes an API).
A screenshot of the Backstage web UI showing an "auth-api" API overview page with an About panel on the left. On the right is a Relations graph linking "guests" → "auth-api" → "auth-service."
Definition property and referencing an external OpenAPI spec
  • Small projects sometimes embed OpenAPI content inline using definition: |.
  • For production or team projects, store the OpenAPI spec in the repository (for example, openapi/auth-api-spec.yaml) and reference that file from the catalog descriptor so Backstage can fetch and render it.
Preferred pattern: reference the raw file using $text (or $json / $text depending on parsing needs). When referencing GitHub-hosted raw files, use the raw.githubusercontent.com URL. Correct example referencing a raw OpenAPI file with $text:
Permission to read external raw hosts
  • Backstage must be allowed to fetch external raw files. If the host is not permitted in your backend config, you’ll see an error like this:
Add hosts you trust and only do this for required sources. Changes to the backend configuration require restarting the backend process.
Add the host to backend.reading.allow in your app-config.yaml so Backstage can read raw files. Example:
After updating app-config.yaml, restart the Backstage backend; otherwise changes won’t take effect and the raw file will still be blocked.
Once allowed and the backend is restarted, Backstage will fetch the raw OpenAPI spec and render the API definition using its OpenAPI viewer — endpoints, paths, and request/response models will be shown in the API’s definition pane.
A screenshot of a Backstage OpenAPI docs page titled "Authentication Service API" showing POST endpoints like /signup, /login, /logout, and /refresh. The Backstage sidebar with navigation (Home, APIs, Docs) is visible on the left.
Define consumers of the API
  • To mark that a component consumes an API, add spec.consumesApis to the consuming component. This is a list of API names.
Example: shopping-cart component declares it consumes the auth-api:
Backstage will then show shopping-cart as a consumer of auth-api, and the auth-api page will list shopping-cart among its consumers.
A screenshot of the Backstage web UI showing a "shopping-cart" component page with an Overview/About panel on the left and a Relations graph on the right. The page includes navigation on the left and tabs like CI/CD, Dependencies, and Docs across the top.
Quick reference checklist Links and references With these patterns you can model APIs and their relationships in Backstage so teams can discover, document, and manage APIs and their consumers/providers across your organization.

Watch Video