badges/shields · error · InvalidParameter

invalid api key

Error message

invalid api key

What it means

This InvalidParameter error is raised by BasePingPongService.validateApiKey when the configured PingPong API key does not start with the required 'sp_' prefix. PingPong (pingpong-go) issues keys of the form sp_..., so any other string is rejected before any network request is made.

Source

Thrown at services/pingpong/pingpong-base.js:17

import { BaseJsonService, InvalidParameter } from '../index.js'

export const description = `
[PingPong](https://pingpong.one/) is a status page and monitoring service.

To see more details about this badge and obtain your api key, visit
[https://my.pingpong.one/integrations/badge-uptime/](https://my.pingpong.one/integrations/badge-uptime/)
`

export const baseUrl = 'https://api.pingpong.one/widget/shields'

export class BasePingPongService extends BaseJsonService {
  static category = 'monitoring'

  static validateApiKey({ apiKey }) {
    if (!apiKey.startsWith('sp_')) {
      throw new InvalidParameter({
        prettyMessage: 'invalid api key',
      })
    }
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Log into your PingPong dashboard and copy the full API key, which must begin with sp_
  2. Set the key correctly in the service config (e.g. privateApiKey or via the configured env var)
  3. Verify no shell quoting/escaping stripped characters from the key
  4. Confirm you are using a PingPong (pingpong-go) key, not a key from another monitoring provider

Example fix

// before
apiKey: 'a1b2c3d4e5f6'
// after
apiKey: 'sp_a1b2c3d4e5f6...'
Defensive patterns

Strategy: validation

Validate before calling

if (typeof apiKey !== 'string' || !apiKey.startsWith('sp_')) throw new Error('PingPong API key must be a string starting with sp_')

Type guard

function isValidPingPongKey(key) {
  return typeof key === 'string' && key.startsWith('sp_') && key.length > 3
}

Try / catch

try {
  BasePingPongService.validateApiKey({ apiKey: config.apiKey })
} catch (e) {
  if (e instanceof InvalidParameter) throw new Error('Config error: PINGPONG_API_KEY must start with sp_')
  throw e
}

Prevention

When it happens

Trigger: Configuring a PingPong badge/service with an apiKey config value that lacks the sp_ prefix — e.g. passing a raw UUID token, a different vendor's key, or a truncated key.

Common situations: Copying the wrong credential type into config/environment; migrating config from another status-page provider; string truncation when pasting the key into env files.

Understand the failure class

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/bc092ece4b44d334. Report an issue: GitHub.