Login.gov · API Governance Rules

Login.gov API Rules

Spectral linting rules defining API design standards and conventions for Login.gov.

7 Rules error 5 warn 2
View Rules File View on GitHub

Rule Categories

login

Rules

warn
login-gov-title-case-summaries
Operation summaries should use Title Case (Login.gov OIDC/SAML house style).
$.paths[*][*].summary
warn
login-gov-operation-id-camel-case
operationId should be camelCase.
$.paths[*][*].operationId
error
login-gov-require-tag
Every operation must be tagged.
$.paths[*][*]
error
login-gov-min-22-char-state-nonce
The `state` and `nonce` parameters MUST be at least 22 characters long.
$.paths['/openid_connect/authorize'].get.parameters[?(@.name=='state' || @.name=='nonce')].schema
error
login-gov-require-prompt-select-account
Authorization requests must declare prompt=select_account.
$.paths['/openid_connect/authorize'].get.parameters[?(@.name=='prompt')].schema.enum
error
login-gov-response-type-code-only
Login.gov supports only response_type=code (implicit flow is not supported).
$.paths['/openid_connect/authorize'].get.parameters[?(@.name=='response_type')].schema.enum
error
login-gov-bearer-on-userinfo
The userinfo endpoint must require bearer authentication.
$.paths['/api/openid_connect/userinfo'].get

Spectral Ruleset

Raw ↑
extends:
- spectral:oas
rules:
  login-gov-title-case-summaries:
    description: Operation summaries should use Title Case (Login.gov OIDC/SAML house style).
    given: $.paths[*][*].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][A-Za-z0-9]*( [A-Z0-9][A-Za-z0-9/.-]*)*$'

  login-gov-operation-id-camel-case:
    description: operationId should be camelCase.
    given: $.paths[*][*].operationId
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'

  login-gov-require-tag:
    description: Every operation must be tagged.
    given: $.paths[*][*]
    severity: error
    then:
      field: tags
      function: truthy

  login-gov-min-22-char-state-nonce:
    description: The `state` and `nonce` parameters MUST be at least 22 characters long.
    given: $.paths['/openid_connect/authorize'].get.parameters[?(@.name=='state' || @.name=='nonce')].schema
    severity: error
    then:
      field: minLength
      function: truthy

  login-gov-require-prompt-select-account:
    description: Authorization requests must declare prompt=select_account.
    given: $.paths['/openid_connect/authorize'].get.parameters[?(@.name=='prompt')].schema.enum
    severity: error
    then:
      function: enumeration
      functionOptions:
        values:
        - select_account

  login-gov-response-type-code-only:
    description: Login.gov supports only response_type=code (implicit flow is not supported).
    given: $.paths['/openid_connect/authorize'].get.parameters[?(@.name=='response_type')].schema.enum
    severity: error
    then:
      function: enumeration
      functionOptions:
        values:
        - code

  login-gov-bearer-on-userinfo:
    description: The userinfo endpoint must require bearer authentication.
    given: $.paths['/api/openid_connect/userinfo'].get
    severity: error
    then:
      field: security
      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/login-gov-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 form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

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