CoinGecko · API Governance Rules

CoinGecko API Rules

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

10 Rules error 3 warn 5 info 2
View Rules File View on GitHub

Rule Categories

coingecko

Rules

error
coingecko-info-contact
API contact information must be present.
$.info
error
coingecko-server-https
All server URLs must use HTTPS.
$.servers[*].url
warn
coingecko-server-host
Server URLs must reference a CoinGecko host.
$.servers[*].url
info
coingecko-versioned-path
Server URLs should expose /api/v3 versioning.
$.servers[*].url
warn
coingecko-api-key-header
Authenticated APIs should use x-cg-demo-api-key or x-cg-pro-api-key.
$.components.securitySchemes[*]
error
coingecko-operation-id
Every operation must declare a unique operationId.
$.paths[*][get,post,put,patch,delete]
warn
coingecko-operation-tags
Operations must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
coingecko-operation-summary
Operations should declare a summary.
$.paths[*][get,post,put,patch,delete]
warn
coingecko-error-responses
GET operations should declare 401 and 429 error responses.
$.paths[*].get.responses
info
coingecko-currency-param
Pricing endpoints should accept vs_currency or vs_currencies.
$.paths[*].get.parameters[?(@.in == 'query')]

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas

# Spectral linting rules for CoinGecko APIs (Crypto Market Data, Pro,
# Onchain DEX). Tuned to api.coingecko.com / pro-api.coingecko.com host
# conventions, x-cg-demo-api-key / x-cg-pro-api-key auth headers, and
# the /api/v3 versioned URI prefix.
rules:
  coingecko-info-contact:
    description: API contact information must be present.
    severity: error
    given: "$.info"
    then:
      field: contact
      function: truthy

  coingecko-server-https:
    description: All server URLs must use HTTPS.
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  coingecko-server-host:
    description: Server URLs must reference a CoinGecko host.
    severity: warn
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "(api\\.coingecko\\.com|pro-api\\.coingecko\\.com)"

  coingecko-versioned-path:
    description: Server URLs should expose /api/v3 versioning.
    severity: info
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "/api/v3"

  coingecko-api-key-header:
    description: Authenticated APIs should use x-cg-demo-api-key or x-cg-pro-api-key.
    severity: warn
    given: "$.components.securitySchemes[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            type:
              const: apiKey
            in:
              const: header
            name:
              enum:
                - x-cg-demo-api-key
                - x-cg-pro-api-key

  coingecko-operation-id:
    description: Every operation must declare a unique operationId.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  coingecko-operation-tags:
    description: Operations must declare at least one tag.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1

  coingecko-operation-summary:
    description: Operations should declare a summary.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  coingecko-error-responses:
    description: GET operations should declare 401 and 429 error responses.
    severity: warn
    given: "$.paths[*].get.responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ["401"]
            - required: ["429"]

  coingecko-currency-param:
    description: Pricing endpoints should accept vs_currency or vs_currencies.
    severity: info
    given: "$.paths[*].get.parameters[?(@.in == 'query')]"
    then:
      field: name
      function: enumeration
      functionOptions:
        values:
          - vs_currency
          - vs_currencies
          - ids
          - id
          - contract_address
          - addresses
          - days
          - precision
          - per_page
          - page
          - order
          - category

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