API Require Base URL
api-require-base-url
info
experience: usabilityexperience: discoverability
spec: apis
APIs MUST Have a Base URL
Each API defined within an APIs.json artifact can specify the base URL for the API. This URL serves as a reference point for developers during onboarding and when making API calls. Additionally, it helps identify the API and validate the domain it is associated with.
Rule definition
The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.
api-require-base-url:
title: API Require Base URL
reference: https://spotlight-rules.com/spec/rules/apis-json/api-require-base-url/
description: Each API defined within an APIs.json artifact can specify the base
URL for the API. This URL serves as a reference point for developers during
onboarding and when making API calls. Additionally, it helps identify the
API and validate the domain it is associated with.
message: APIs MUST Have a Base URL
severity: info
given: $.apis.*
then:
field: baseURL
function: truthy
tags:
- format:apis-json
- spec:apis
- experience:usability
- experience:discoverability
prompt: "You are editing an APIs.json document to satisfy the Spotlight API
governance rule 'api-require-base-url' (API Require Base URL). Requirement:
Each API defined within an APIs.json artifact can specify the base URL for
the API. This URL serves as a reference point for developers during
onboarding and when making API calls. Additionally, it helps identify the
API and validate the domain it is associated with. To fix: Ensure `baseURL`
is present and non-empty at each matching location. This rule is evaluated
at the JSONPath `$.apis.*` — inspect every location it matches and correct
only what violates the rule. Make the smallest change that satisfies the
rule, leave all unrelated content, key order, comments, and formatting
unchanged, and keep the document valid APIs.json. Return only the complete
corrected document, with no commentary."
AI fix prompt — send this to Claude, Gemini, or ChatGPT with your artifact to auto-fix this rule
You are editing an APIs.json document to satisfy the Spotlight API governance rule 'api-require-base-url' (API Require Base URL). Requirement: Each API defined within an APIs.json artifact can specify the base URL for the API. This URL serves as a reference point for developers during onboarding and when making API calls. Additionally, it helps identify the API and validate the domain it is associated with. To fix: Ensure `baseURL` is present and non-empty at each matching location. This rule is evaluated at the JSONPath `$.apis.*` — inspect every location it matches and correct only what violates the rule. Make the smallest change that satisfies the rule, leave all unrelated content, key order, comments, and formatting unchanged, and keep the document valid APIs.json. Return only the complete corrected document, with no commentary.
| Artifact | APIs.json |
|---|---|
| Applies at (given) | $.apis.* |
| Severity | info — educational by default; raise to warn/error to enforce |
| Reference | https://spotlight-rules.com/spec/rules/apis-json/api-require-base-url/ |