{"_id":"@chengyixu/api-health","name":"@chengyixu/api-health","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@chengyixu/api-health","version":"1.0.0","description":"Monitor API endpoints from the command line. Check response times, status codes, SSL certificate expiry, and get a beautiful dashboard.","main":"dist/index.js","bin":{"api-health":"dist/cli.js"},"scripts":{"build":"tsc","start":"node dist/cli.js","prepublishOnly":"npm run build"},"keywords":["api","health","monitor","uptime","cli","dashboard","ssl","response-time","status-code","endpoint","ping","devops"],"author":{"name":"Chengyi Xu"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/chengyixu/api-health.git"},"homepage":"https://github.com/chengyixu/api-health","engines":{"node":">=16.0.0"},"dependencies":{"chalk":"^4.1.2","commander":"^11.1.0","cli-table3":"^0.6.3","ora":"^5.4.1"},"devDependencies":{"typescript":"^5.3.3","@types/node":"^20.10.0"},"types":"./dist/index.d.ts","_id":"@chengyixu/api-health@1.0.0","bugs":{"url":"https://github.com/chengyixu/api-health/issues"},"_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-zNiuhFn4GhRwduo3bO0+a1Z5cUVAFDhpn1U4fqbRjX53YkFDIBET59pzII4tr+ixUbUoAnYt1FKlRHfd5sjbkw==","shasum":"7be66eb5c5f268a8be07dc73e5baf6de17c94602","tarball":"https://registry.npmjs.org/@chengyixu/api-health/-/api-health-1.0.0.tgz","fileCount":22,"unpackedSize":70486,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIE+5wE69ITEZ3U6sK2Ro04zRUbE4NI3CiD1Yp2sBv0T6AiEAzYipY0rn4RAB1vz743sSrwvh4aEI1SjM7dpr2pdnj4s="}]},"_npmUser":{"name":"chengyixu","email":"Chengyi_xu@outlook.com"},"directories":{},"maintainers":[{"name":"chengyixu","email":"Chengyi_xu@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/api-health_1.0.0_1773907593356_0.36144462849160175"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-19T08:06:33.257Z","1.0.0":"2026-03-19T08:06:33.485Z","modified":"2026-03-19T08:06:34.029Z"},"maintainers":[{"name":"chengyixu","email":"Chengyi_xu@outlook.com"}],"description":"Monitor API endpoints from the command line. Check response times, status codes, SSL certificate expiry, and get a beautiful dashboard.","homepage":"https://github.com/chengyixu/api-health","keywords":["api","health","monitor","uptime","cli","dashboard","ssl","response-time","status-code","endpoint","ping","devops"],"repository":{"type":"git","url":"git+https://github.com/chengyixu/api-health.git"},"author":{"name":"Chengyi Xu"},"bugs":{"url":"https://github.com/chengyixu/api-health/issues"},"license":"MIT","readme":"# @chengyixu/api-health\n\nMonitor API endpoints from the command line. Check response times, status codes, SSL certificate expiry, and get a beautiful dashboard.\n\n## Features\n\n- **Dashboard view** — Color-coded status, response times, SSL expiry at a glance\n- **SSL certificate checking** — See issuer, expiry date, TLS protocol, days until expiry\n- **Multiple endpoints** — Check many APIs in parallel with configurable concurrency\n- **Watch mode** — Continuously monitor endpoints at any interval\n- **JSON output** — Pipe results to other tools or store for analysis\n- **Detailed reports** — Full response headers, security headers, content info\n- **Config file support** — Save your endpoints in `api-health.json` for easy re-runs\n- **CI/CD friendly** — Exits with code 1 if any endpoint is down or returns 5xx\n\n## Install\n\n```bash\nnpm install -g @chengyixu/api-health\n```\n\n## Usage\n\n### Quick check\n\n```bash\n# Check one or more endpoints\napi-health check https://api.example.com https://api2.example.com\n\n# Auto-prepends https:// if missing\napi-health check api.github.com google.com\n```\n\n### Dashboard output\n\n```\n  API Health Dashboard\n  2024-01-15T10:30:00.000Z\n\n┌───┬─────────────────────────────────┬──────────┬──────────┬──────────┬────────────┐\n│   │ Endpoint                        │ Status   │ Time     │ Size     │ SSL Expiry │\n├───┼─────────────────────────────────┼──────────┼──────────┼──────────┼────────────┤\n│ ✔ │ https://api.github.com          │ 200      │ 142ms    │ 2.1KB    │ 76d        │\n├───┼─────────────────────────────────┼──────────┼──────────┼──────────┼────────────┤\n│ ✔ │ https://httpbin.org/get         │ 200      │ 312ms    │ 243B     │ 151d       │\n├───┼─────────────────────────────────┼──────────┼──────────┼──────────┼────────────┤\n│ ✘ │ https://down.example.com        │ ERR      │ -        │ -        │ -          │\n└───┴─────────────────────────────────┴──────────┴──────────┴──────────┴────────────┘\n\n  Summary: 2/3 healthy | 1 errors | avg 227ms\n\n  SSL Warnings:\n    ⚠ https://expiring.example.com — SSL expires in 12 days\n```\n\n### SSL certificate check\n\n```bash\napi-health ssl google.com github.com stripe.com\n```\n\n### JSON output (for scripting/CI)\n\n```bash\napi-health check --json https://api.example.com\n```\n\n### Detailed report\n\n```bash\napi-health check --detailed https://api.example.com\n```\n\nShows response headers, security headers, full SSL certificate info.\n\n### Watch mode\n\n```bash\n# Monitor every 30 seconds (default)\napi-health watch https://api.example.com\n\n# Custom interval\napi-health watch -i 10 https://api.example.com https://api2.example.com\n```\n\n### Config file\n\nCreate an `api-health.json` in your project:\n\n```bash\napi-health init\n```\n\nThis generates:\n\n```json\n{\n  \"endpoints\": [\n    {\n      \"url\": \"https://api.github.com\",\n      \"name\": \"GitHub API\",\n      \"expectedStatus\": 200\n    },\n    {\n      \"url\": \"https://httpbin.org/get\",\n      \"name\": \"HTTPBin\"\n    }\n  ],\n  \"defaults\": {\n    \"timeout\": 10000,\n    \"method\": \"GET\"\n  }\n}\n```\n\nThen just run:\n\n```bash\napi-health check\n```\n\n## Options\n\n| Flag | Description | Default |\n|------|-------------|---------|\n| `-t, --timeout <ms>` | Request timeout | `10000` |\n| `-m, --method <method>` | HTTP method | `GET` |\n| `-H, --header <key:value>` | Custom header (repeatable) | - |\n| `-j, --json` | JSON output | `false` |\n| `-d, --detailed` | Detailed report | `false` |\n| `-c, --config <path>` | Config file path | auto-detect |\n| `--concurrency <n>` | Max parallel requests | `5` |\n| `--no-ssl` | Skip SSL check | `false` |\n\n## Use Cases\n\n- **Pre-deploy checks** — Verify all your APIs are healthy before deploying\n- **SSL monitoring** — Get warned before certificates expire\n- **CI/CD pipelines** — Add health checks to your deployment pipeline\n- **On-call dashboards** — Quick terminal dashboard for incident response\n- **Performance monitoring** — Track response time trends\n\n## Programmatic API\n\n```typescript\nimport { checkEndpoint, checkMultipleEndpoints } from '@chengyixu/api-health';\n\nconst result = await checkEndpoint('https://api.example.com', {\n  timeout: 5000,\n  method: 'GET',\n});\n\nconsole.log(result.status);        // 200\nconsole.log(result.responseTime);  // 142\nconsole.log(result.ssl?.daysUntilExpiry); // 76\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-a74a0c58c3b8e4894d89d534e5c583ea"}