badges/shields · error · InvalidParameter

monitor API key is unvalid

Error message

monitor API key is unvalid

What it means

UptimeObserver's ensureIsMonitorApiKey throws this InvalidParameter when a monitorKey is supplied but is 32 characters or shorter. The service expects a long (presumably 33+ character) monitor-specific API key, so short values are rejected as invalid before any request. Note the service's own spelling: 'unvalid'.

Source

Thrown at services/uptimeobserver/uptimeobserver-base.js:26

const monitorResponse = Joi.object({
  status: Joi.string().required(),
  uptime24h: Joi.number().min(0).max(100).required(),
  uptime7d: Joi.number().min(0).max(100).required(),
  uptime30d: Joi.number().min(0).max(100).required(),
}).required()

const singleMonitorResponse = Joi.alternatives(monitorResponse, errorResponse)

export default class UptimeObserverBase extends BaseJsonService {
  static category = 'monitoring'

  static ensureIsMonitorApiKey(value) {
    if (!value) {
      throw new InvalidParameter({
        prettyMessage: 'monitor API key is required',
      })
    } else if (value.length <= 32) {
      throw new InvalidParameter({
        prettyMessage: 'monitor API key is unvalid',
      })
    }
  }

  async fetch({ monitorKey }) {
    this.constructor.ensureIsMonitorApiKey(monitorKey)

    // Docs for API: https://support.uptimeobserver.com/shields-api.yaml
    const url = `https://app.uptimeobserver.com/api/monitor/status/${monitorKey}`

    const response = await this._requestJson({
      schema: singleMonitorResponse,
      url,
      options: {
        method: 'GET',
      },
      logErrors: [],

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Copy the full monitor API key from the UptimeObserver dashboard (do not truncate).
  2. Confirm you are using the monitor-specific key, not another token or the monitor id.
  3. Check for URL/config trimming that could cut the key short (e.g. template truncation, quoting issues).

Example fix

// before
?monitorKey=abc123def456 (12 chars)
// after
?monitorKey=full-64-character-monitor-key-from-dashboard
Defensive patterns

Strategy: validation

Validate before calling

if (!monitorKey || monitorKey.length <= 32) throw new Error('monitorKey must be the full monitor API key (>32 chars)')

Type guard

const isValidKey = (v) => typeof v === 'string' && v.length > 32

Try / catch

try { await fetchBadge() } catch (e) { if (e instanceof InvalidParameter) console.error('monitorKey too short — copy the full key'); throw e }

Prevention

When it happens

Trigger: Passing a monitorKey query parameter whose length is <= 32 to any uptime-observer badge; the guard runs inside fetch() before the upstream API call.

Common situations: Using a truncated/copy-pasted key; using an account-level key or some other id/token that is not the full monitor key; hand-typing the key and missing characters.

Related errors


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