Unstatus API

Errors

API error codes and how to handle them.

All errors return a consistent JSON envelope:

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Monitor not found"
  }
}

HTTP Status Codes

StatusCodeDescription
400BAD_REQUESTInvalid request body or parameters
401UNAUTHORIZEDMissing, invalid, or expired API key
403FORBIDDENAuthenticated, but not allowed to perform the action
404NOT_FOUNDResource not found or does not belong to your organization
429RATE_LIMITEDRate limit exceeded
502BAD_GATEWAYUpstream service (e.g., worker) failed
503SERVICE_UNAVAILABLEService temporarily unavailable
500INTERNAL_ERRORUnexpected server error

Handling Errors

Error handling
const res = await fetch("https://unstatus.app/api/v1/monitors", {
  headers: { Authorization: `Bearer ${apiKey}` },
});

if (!res.ok) {
  const { error } = await res.json();
  console.error(`API error: ${error.code} - ${error.message}`);
  // Handle specific codes
  if (error.code === "UNAUTHORIZED") {
    // Re-authenticate
  }
}

On this page