MarineTraffic · API Governance Rules

MarineTraffic API Rules

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

7 Rules error 2 warn 4 info 1
View Rules File View on GitHub

Rule Categories

marinetraffic

Rules

error
marinetraffic-server-base
All MarineTraffic AIS API specs must declare the canonical services.marinetraffic.com base server.
$.servers
warn
marinetraffic-api-key-in-path
MarineTraffic operations authenticate via an `api_key` path parameter — every path must end in `/{api_key}`.
$.paths.*
warn
marinetraffic-operation-summary-title-case
Operation summaries must use Title Case.
$.paths[*][get,post,put,delete,patch].summary
error
marinetraffic-operation-must-have-tag
Each operation must declare exactly one tag drawn from the MarineTraffic taxonomy.
$.paths[*][get,post,put,delete,patch]
info
marinetraffic-response-content-json
GET responses should declare an `application/json` content type. CSV / JSONO variants are allowed via the `protocol` parameter but JSON must be the default.
$.paths[*][get].responses['200'].content
warn
marinetraffic-no-trailing-slashes-in-paths
Paths must not contain trailing whitespace (Redocly-style operation overloading creates duplicate path keys — not portable).
$.paths
warn
marinetraffic-parameter-protocol-enum
When a `protocol` query parameter exists, its schema must enumerate json / jsono / csv / xml.
$..parameters[?(@.name=='protocol')].schema

Spectral Ruleset

Raw ↑
extends:
  - [spectral:oas, recommended]
documentationUrl: https://servicedocs.marinetraffic.com/
functions: []
rules:
  marinetraffic-server-base:
    description: All MarineTraffic AIS API specs must declare the canonical services.marinetraffic.com base server.
    severity: error
    given: $.servers
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1
          contains:
            type: object
            properties:
              url:
                type: string
                pattern: '^https://services\.marinetraffic\.com'
            required: [url]

  marinetraffic-api-key-in-path:
    description: MarineTraffic operations authenticate via an `api_key` path parameter — every path must end in `/{api_key}`.
    severity: warn
    given: $.paths.*
    then:
      function: pattern
      field: '@key'
      functionOptions:
        match: '.*\{api_key\}\s*$'

  marinetraffic-operation-summary-title-case:
    description: Operation summaries must use Title Case.
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][\\w''-]*)( (?:[A-Z][\\w''-]*|of|the|and|in|to|for|by|on|at|a|an|or|with|via))*$'

  marinetraffic-operation-must-have-tag:
    description: Each operation must declare exactly one tag drawn from the MarineTraffic taxonomy.
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1
          maxItems: 1
          items:
            type: string
            enum:
              - AIS API
              - Vessel Positions (Legacy API)
              - Vessel Historical Track
              - Single Vessel Events
              - Port Events
              - Vessel Information
              - Search Vessel
              - Voyage Information
              - Ports Information
              - Routing Information
              - Reverse Geocoding
              - Fleets
              - Balances
              - Passage Plans
              - Containers API
              - MT Inbox

  marinetraffic-response-content-json:
    description: GET responses should declare an `application/json` content type. CSV / JSONO variants are allowed via the `protocol` parameter but JSON must be the default.
    severity: info
    given: $.paths[*][get].responses['200'].content
    then:
      function: truthy
      field: 'application/json'

  marinetraffic-no-trailing-slashes-in-paths:
    description: Paths must not contain trailing whitespace (Redocly-style operation overloading creates duplicate path keys — not portable).
    severity: warn
    given: $.paths
    then:
      function: pattern
      field: '@key'
      functionOptions:
        notMatch: '\s+$'

  marinetraffic-parameter-protocol-enum:
    description: When a `protocol` query parameter exists, its schema must enumerate json / jsono / csv / xml.
    severity: warn
    given: $..parameters[?(@.name=='protocol')].schema
    then:
      field: enum
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            enum: [json, jsono, csv, xml]

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/marine-traffic-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.