Last.fm · API Governance Rules

Last.fm API Rules

Spectral linting rules defining API design standards and conventions for Last.fm.

13 Rules error 6 warn 4 info 3
View Rules File View on GitHub

Rule Categories

lastfm

Rules

error
lastfm-operation-ids-required
All operations must have an operationId.
$.paths[*][get,post,put,patch,delete]
error
lastfm-operation-summary-required
All operations must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
lastfm-operation-summary-title-case
Operation summaries should use Title Case.
$.paths[*][get,post,put,patch,delete].summary
error
lastfm-tags-required
All operations must have at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
lastfm-api-key-required
All read operations should accept the api_key parameter.
$.paths[?(@property.match(/method=/))].get.parameters[*]
warn
lastfm-method-name-convention
Method names should follow `package.methodName` naming (camelCase method).
$.paths[*]
error
lastfm-write-operations-require-post
Write methods (addTags, removeTag, scrobble, love, unlove, updateNowPlaying, getSession, getMobileSession) must use POST.
$.paths[?(@property.match(/addTags|removeTag|scrobble|love|unlove|updateNowPlaying|getMobileSession/))]
error
lastfm-response-200-required
All operations must document a 200 response.
$.paths[*][get,post,put,patch,delete]
info
lastfm-error-codes-documented
Documented Last.fm numeric error codes should be referenced in descriptions.
$.components.schemas.ErrorPayload.properties.error.description
info
lastfm-rate-limit-documented
API description should mention the 5 req/sec/origin rate guidance.
$.info.description
error
lastfm-security-defined
API must define ApiKeyAuth and SignedAuth security schemes.
$.components.securitySchemes
warn
lastfm-base-url-canonical
Primary server URL must be https://ws.audioscrobbler.com/2.0.
$.servers[0].url
info
lastfm-format-param-json
Operations should support format=json via the format query parameter.
$.components.parameters.FormatParam.schema.enum

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  lastfm-operation-ids-required:
    description: All operations must have an operationId.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  lastfm-operation-summary-required:
    description: All operations must have a summary.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  lastfm-operation-summary-title-case:
    description: Operation summaries should use Title Case.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].summary"
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-zA-Z0-9]*)(\\s+([A-Z][a-zA-Z0-9]*|For|By|To|And|Or|Of|The|A|An))*$"

  lastfm-tags-required:
    description: All operations must have at least one tag.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  lastfm-api-key-required:
    description: All read operations should accept the api_key parameter.
    severity: warn
    given: "$.paths[?(@property.match(/method=/))].get.parameters[*]"
    then:
      function: defined

  lastfm-method-name-convention:
    description: Method names should follow `package.methodName` naming (camelCase method).
    severity: warn
    given: "$.paths[*]"
    then:
      function: pattern
      functionOptions:
        match: "^/\\?method=[a-z]+\\.[a-zA-Z]+$|^/$"

  lastfm-write-operations-require-post:
    description: Write methods (addTags, removeTag, scrobble, love, unlove, updateNowPlaying, getSession, getMobileSession) must use POST.
    severity: error
    given: "$.paths[?(@property.match(/addTags|removeTag|scrobble|love|unlove|updateNowPlaying|getMobileSession/))]"
    then:
      field: post
      function: truthy

  lastfm-response-200-required:
    description: All operations must document a 200 response.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: responses.200
      function: truthy

  lastfm-error-codes-documented:
    description: Documented Last.fm numeric error codes should be referenced in descriptions.
    severity: info
    given: "$.components.schemas.ErrorPayload.properties.error.description"
    then:
      function: truthy

  lastfm-rate-limit-documented:
    description: API description should mention the 5 req/sec/origin rate guidance.
    severity: info
    given: "$.info.description"
    then:
      function: truthy

  lastfm-security-defined:
    description: API must define ApiKeyAuth and SignedAuth security schemes.
    severity: error
    given: "$.components.securitySchemes"
    then:
      function: truthy

  lastfm-base-url-canonical:
    description: Primary server URL must be https://ws.audioscrobbler.com/2.0.
    severity: warn
    given: "$.servers[0].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://ws\\.audioscrobbler\\.com/2\\.0$"

  lastfm-format-param-json:
    description: Operations should support format=json via the format query parameter.
    severity: info
    given: "$.components.parameters.FormatParam.schema.enum"
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            const: json

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