Country State City API · API Governance Rules

Country State City API API Rules

Spectral linting rules defining API design standards and conventions for Country State City API.

7 Rules error 4 warn 3
View Rules File View on GitHub

Rule Categories

csc

Rules

error
csc-info-title
API title must mention Country State City.
$.info.title
warn
csc-server-base-url
Servers must reference https://api.countrystatecity.in/v1.
$.servers[*].url
error
csc-api-key-security
Spec must define an X-CSCAPI-KEY API key security scheme.
$.components.securitySchemes
warn
csc-global-security
API must apply the API key security globally.
$
error
csc-operation-id
Every operation must define an operationId.
$.paths.*.get
error
csc-operation-tags
Every operation must define at least one tag.
$.paths.*.get
warn
csc-401-response
All authenticated operations should document a 401 response.
$.paths.*.get.responses

Spectral Ruleset

Raw ↑
extends: ["spectral:oas"]
documentationUrl: https://docs.countrystatecity.in/api/introduction
rules:
  csc-info-title:
    description: API title must mention Country State City.
    given: "$.info.title"
    severity: error
    then:
      function: pattern
      functionOptions:
        match: "Country State City"
  csc-server-base-url:
    description: Servers must reference https://api.countrystatecity.in/v1.
    given: "$.servers[*].url"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: "api.countrystatecity.in"
  csc-api-key-security:
    description: Spec must define an X-CSCAPI-KEY API key security scheme.
    given: "$.components.securitySchemes"
    severity: error
    then:
      field: ApiKeyAuth
      function: truthy
  csc-global-security:
    description: API must apply the API key security globally.
    given: "$"
    severity: warn
    then:
      field: security
      function: truthy
  csc-operation-id:
    description: Every operation must define an operationId.
    given: "$.paths.*.get"
    severity: error
    then:
      field: operationId
      function: truthy
  csc-operation-tags:
    description: Every operation must define at least one tag.
    given: "$.paths.*.get"
    severity: error
    then:
      field: tags
      function: truthy
  csc-401-response:
    description: All authenticated operations should document a 401 response.
    given: "$.paths.*.get.responses"
    severity: warn
    then:
      field: '401'
      function: truthy

Work with this as data

Every ruleset here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools

Call it yourself

curl for this page
This ruleset
curl "https://apis.io/api/v1/rules/country-state-city-api-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.