positionstack · API Governance Rules

positionstack API Rules

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

8 Rules error 3 warn 4 info 1
View Rules File View on GitHub

Rule Categories

positionstack

Rules

error
positionstack-access-key-required
Every operation must include an `access_key` query parameter (security requirement).
$.paths[*][get,post,put,delete,patch]
warn
positionstack-operation-summary-title-case
Operation summaries should be Title Case (e.g. "Forward Geocode an Address").
$.paths[*][get,post,put,delete,patch].summary
info
positionstack-supports-output-formats
Geocoding endpoints should expose `output` parameter accepting json, xml, or geojson.
$.paths[/forward,/reverse].get.parameters[?(@.name=='output')].schema.enum
warn
positionstack-version-path
All paths should be served under the single canonical /v1 base path.
$.servers[*].url
error
positionstack-module-flag-enum
Module-enable parameters (`country_module`, `sun_module`, `timezone_module`, `bbox_module`) must accept only 0 or 1.
$.paths[*].get.parameters[?(@.name=~/_module$/)].schema
error
positionstack-limit-max-80
The `limit` parameter must enforce a maximum of 80 (positionstack hard cap).
$.paths[*].get.parameters[?(@.name=='limit')].schema
warn
positionstack-quota-responses
Operations should document 401 (auth) and 429 (quota) error responses.
$.paths[*][get,post].responses
warn
positionstack-error-envelope
Error responses should reference the shared ErrorResponse schema.
$.paths[*][get,post].responses[401,403,404,429,500].content.application/json.schema.$ref

Spectral Ruleset

Raw ↑
# Spectral ruleset enforcing positionstack OpenAPI conventions.
# Apply with: spectral lint openapi/positionstack-openapi.yml --ruleset rules/positionstack-rules.yml
extends:
  - spectral:oas
rules:
  # All operations must require an access_key query parameter
  positionstack-access-key-required:
    description: Every operation must include an `access_key` query parameter (security requirement).
    severity: error
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            parameters:
              type: array
              contains:
                type: object
                properties:
                  name:
                    const: access_key
                  in:
                    const: query
                  required:
                    const: true
                required: [name, in, required]
          required: [parameters]

  # Operation summaries must use Title Case
  positionstack-operation-summary-title-case:
    description: Operation summaries should be Title Case (e.g. "Forward Geocode an Address").
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"

  # Endpoints must support standard output formats
  positionstack-supports-output-formats:
    description: Geocoding endpoints should expose `output` parameter accepting json, xml, or geojson.
    severity: info
    given: "$.paths[/forward,/reverse].get.parameters[?(@.name=='output')].schema.enum"
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains: { const: json }

  # Paths must remain under /v1 (single canonical version)
  positionstack-version-path:
    description: All paths should be served under the single canonical /v1 base path.
    severity: warn
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "/v1$"

  # Add-on modules must be opt-in via 0/1 flag
  positionstack-module-flag-enum:
    description: Module-enable parameters (`country_module`, `sun_module`, `timezone_module`, `bbox_module`) must accept only 0 or 1.
    severity: error
    given: "$.paths[*].get.parameters[?(@.name=~/_module$/)].schema"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            enum:
              type: array
              items: { type: integer, enum: [0, 1] }
          required: [enum]

  # Limit must cap at 80 (positionstack hard limit)
  positionstack-limit-max-80:
    description: The `limit` parameter must enforce a maximum of 80 (positionstack hard cap).
    severity: error
    given: "$.paths[*].get.parameters[?(@.name=='limit')].schema"
    then:
      field: maximum
      function: schema
      functionOptions:
        schema:
          type: integer
          maximum: 80

  # Responses must include 401/429 for auth / quota
  positionstack-quota-responses:
    description: Operations should document 401 (auth) and 429 (quota) error responses.
    severity: warn
    given: "$.paths[*][get,post].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required: ["200", "401", "429"]

  # Error responses must use the standard apilayer error envelope
  positionstack-error-envelope:
    description: Error responses should reference the shared ErrorResponse schema.
    severity: warn
    given: "$.paths[*][get,post].responses[401,403,404,429,500].content.application/json.schema.$ref"
    then:
      function: pattern
      functionOptions:
        match: "ErrorResponse$"

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/positionstack-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.