Errors

The STIG Viewer API uses standard HTTP status codes to indicate the success or failure of requests.

Error Format

All error responses follow this JSON format:

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  }
}

Status Codes

CodeError CodeDescription
200-Success
400BAD_REQUESTInvalid query parameters (e.g., invalid format)
401UNAUTHORIZEDMissing, invalid, or expired token
404NOT_FOUNDSTIG not found with the specified slug
500INTERNAL_ERRORServer error

Examples

401 - Unauthorized

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing or invalid Authorization header"
  }
}

400 - Bad Request

{
  "error": {
    "code": "BAD_REQUEST",
    "message": "Invalid format. Must be one of: json, csv, xml"
  }
}

404 - Not Found

{
  "error": {
    "code": "NOT_FOUND",
    "message": "STIG not found: invalid-slug"
  }
}

Was this page helpful?