Knock · API Governance Rules

Knock API Rules

Spectral linting rules defining API design standards and conventions for Knock.

8 Rules error 3 warn 3 info 2
View Rules File View on GitHub

Rule Categories

knock

Rules

error
knock-server-base-url
Knock OpenAPI specs MUST list either api.knock.app or control.knock.app as a server.
$.servers[*].url
error
knock-bearer-auth
Knock APIs MUST require bearer-token authentication.
$.components.securitySchemes[*]
error
knock-paths-v1-prefix
All Knock API paths MUST be under /v1/.
$.paths
warn
knock-operation-summary-required
Every operation should have a summary.
$.paths.*[get,post,put,patch,delete]
warn
knock-snake-case-properties
Knock JSON property names are snake_case.
$.components.schemas..properties.*~
warn
knock-pagination-cursor
List endpoints should support cursor pagination (before/after) over offset.
$.paths.*.get.parameters[?(@.name=='page' || @.name=='offset')]
info
knock-rate-limit-headers-documented
429 responses should document rate-limit retry behavior.
$.paths.*.*.responses['429']
info
knock-idempotency-key-header
POST endpoints SHOULD accept an Idempotency-Key header.
$.paths.*.post.parameters[*].name

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]
documentationUrl: https://docs.knock.app/api-reference/overview
functions: []
rules:
  knock-server-base-url:
    description: Knock OpenAPI specs MUST list either api.knock.app or control.knock.app as a server.
    message: 'Knock specs must use api.knock.app (runtime API) or control.knock.app (Management API) as a server.'
    severity: error
    given: '$.servers[*].url'
    then:
      function: pattern
      functionOptions:
        match: '^https://(api|control)\.knock\.app$'

  knock-bearer-auth:
    description: Knock APIs MUST require bearer-token authentication.
    severity: error
    given: '$.components.securitySchemes[*]'
    then:
      - field: type
        function: enumeration
        functionOptions:
          values: [http]
      - field: scheme
        function: enumeration
        functionOptions:
          values: [bearer]

  knock-paths-v1-prefix:
    description: All Knock API paths MUST be under /v1/.
    severity: error
    given: '$.paths'
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: '^/v1/'

  knock-operation-summary-required:
    description: Every operation should have a summary.
    severity: warn
    given: '$.paths.*[get,post,put,patch,delete]'
    then:
      field: summary
      function: truthy

  knock-snake-case-properties:
    description: Knock JSON property names are snake_case.
    severity: warn
    given: '$.components.schemas..properties.*~'
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-z0-9_]*$'

  knock-pagination-cursor:
    description: List endpoints should support cursor pagination (before/after) over offset.
    severity: warn
    given: "$.paths.*.get.parameters[?(@.name=='page' || @.name=='offset')]"
    then:
      function: falsy

  knock-rate-limit-headers-documented:
    description: 429 responses should document rate-limit retry behavior.
    severity: info
    given: "$.paths.*.*.responses['429']"
    then:
      field: description
      function: truthy

  knock-idempotency-key-header:
    description: POST endpoints SHOULD accept an Idempotency-Key header.
    severity: info
    given: '$.paths.*.post.parameters[*].name'
    then:
      function: undefined

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/knock-app-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.