npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

apilens-cli

v0.1.3

Published

A lightweight CLI toolkit for inspecting APIs, HTTP behavior, performance, CORS, security headers, and responses.

Readme

🔎 APILens

«Inspect. Understand. Debug.»

APILens is a lightweight command-line toolkit for inspecting APIs and understanding how they behave.

It analyzes API availability, response performance, HTTPS configuration, security headers, CORS policies, redirects, HTTP methods, response structure, content types, and more — directly from your terminal.


✨ Features

  • 📡 API Availability — Check whether an endpoint is reachable and inspect its HTTP status.
  • ⚡ Response Performance — Measure request latency and classify response speed.
  • 🔐 Security Inspection — Check HTTPS and common security-related response headers.
  • 🌐 CORS Detection — Inspect common Cross-Origin Resource Sharing headers.
  • ↪️ Redirect Detection — Detect redirects and display their destinations.
  • 🔧 HTTP Methods — Inspect the server's advertised "Allow" methods.
  • 📊 JSON Analysis — Validate and inspect JSON responses.
  • 🧩 Response Structure — Detect objects, arrays, item counts, and object keys.
  • 📦 Response Size — Measure the size of the returned response.
  • 📄 Content-Type Detection — Identify JSON, HTML, plain text, and other response types.
  • 📤 Custom Headers — Send custom HTTP request headers.
  • 💻 Simple CLI — Designed to be quick and easy to use from the terminal.
  • 🪶 Lightweight — Minimal setup and dependency-friendly.

📋 Table of Contents


Requirements

Before installing APILens, make sure you have:

  • Node.js 20 or newer
  • npm
  • An active internet connection

You can check your Node.js version with:

node --version

Installation

Install APILens globally using npm:

npm install -g apilens-cli

Verify that the installation was successful:

apilens --version

To view the available commands and options:

apilens --help

Usage

The basic syntax is:

apilens <url>

Example

apilens https://jsonplaceholder.typicode.com/posts

APILens sends a request to the specified endpoint and generates an inspection report directly in your terminal.


Testing APILens

You can test APILens using publicly accessible APIs.

JSONPlaceholder

apilens https://jsonplaceholder.typicode.com/posts

HTTPBin

apilens https://httpbin.org/json

Example.com

apilens https://example.com

Testing Custom Headers

apilens https://httpbin.org/headers --header "X-Test: APILens"

Custom Request Headers

APILens supports custom HTTP request headers using:

--header

or the shorter:

-H

Example

apilens https://httpbin.org/headers --header "X-Test: APILens"

Multiple headers can also be supplied.

Windows PowerShell

apilens https://httpbin.org/headers --header "X-Test: APILens" --header "X-Environment: Development"

Linux / macOS

apilens https://httpbin.org/headers
--header "X-Test: APILens"
--header "X-Environment: Development"

APILens sends the supplied headers with the request and reports the request information as part of the inspection.


🔍 What APILens Checks

Availability

APILens checks whether the target endpoint can be reached and reports its HTTP status.

Example:

📡 AVAILABILITY
Status ✓ 200 OK
Connection ✓ Reachable

If the endpoint cannot be reached, APILens reports the reason and exits with an error status.


Performance

APILens measures the approximate response latency of the request.

Example:

⚡ PERFORMANCE
Latency 320ms
Assessment ✓ Fast

Response-Time Classification

Response Time| Assessment
"< 500ms"| ✓ Fast
"500–999ms"| ⚠ Moderate
"1000ms+"| 🔴 Slow

Response time can vary depending on your network connection, server location, API load, and other environmental factors.


Security

APILens checks whether the endpoint uses HTTPS and inspects several security-related response headers.

Currently Checked

  • "Strict-Transport-Security"
  • "Content-Security-Policy"
  • "X-Frame-Options"
  • "X-Content-Type-Options"
  • "Referrer-Policy"

Example:

🔐 SECURITY HTTPS ✓ Enabled
HSTS ⚠ Missing
Content-Security-Policy ⚠ Missing
X-Frame-Options ⚠ Missing
X-Content-Type-Options ✓ Present
Referrer-Policy ⚠ Missing

«Note: A missing security header does not automatically mean that an API is vulnerable. APILens provides inspection signals that can help developers investigate an endpoint further.»


CORS

APILens checks common Cross-Origin Resource Sharing (CORS) response headers.

It can detect:

  • "Access-Control-Allow-Origin"
  • "Access-Control-Allow-Methods"
  • "Access-Control-Allow-Headers"
  • "Access-Control-Allow-Credentials"

Example:

🌐 CORS
Origin ✓
Credentials ✓ true

If no CORS policy is detected:

🌐 CORS
Policy ⚠ Not detected

CORS behavior can depend on the request origin and server configuration.


Redirects

APILens detects HTTP redirects and reports the destination when available.

Example:

↪️ REDIRECTS
Status ⚠ Redirect detected
Destination → https://example.com/ \

If there is no redirect:

↪️ REDIRECTS
Status ✓ No redirect \


HTTP Methods

APILens checks whether the server advertises supported HTTP methods through the "Allow" response header.

Example:

🔧 HTTP METHODS
Allow ✓ GET, POST, PUT, DELETE

If the server does not advertise the header:

🔧 HTTP METHODS
Allow ⚠ Not advertised

«Note: Not advertising an "Allow" header does not necessarily mean that other HTTP methods are unavailable.»


Response Analysis

APILens analyzes the returned response body.

For JSON responses, it checks:

  • JSON validity
  • Response structure
  • Object or array type
  • Number of items
  • Object keys
  • Response size

Example:

📊 RESPONSE ANALYSIS
Type json
Size 26.88 KB
JSON ✓ Valid
Structure array
Items 100
Keys userId, id, title, body

Object Response

For an object response:

📊 RESPONSE ANALYSIS
Type json
Size 0.29 KB
JSON ✓ Valid
Structure object
Keys headers


Content

APILens reports the response "Content-Type".

Example:

📄 CONTENT
Type application/json; charset=utf-8

This allows you to quickly identify whether an endpoint returned:

  • JSON
  • HTML
  • Plain text
  • XML
  • or another content type

Example Output

Running:

apilens https://jsonplaceholder.typicode.com/posts

may produce output similar to:

╭────────────────────────────────────────╮
│ 🔎 APILENS │
│ API Inspection Toolkit │ ╰────────────────────────────────────────╯ \

TARGET https://jsonplaceholder.typicode.com/posts

────────────────────────────────────────

📤 REQUEST
Method GET
Headers None \

📡 AVAILABILITY
Status ✓ 200 OK
Connection ✓ Reachable \

⚡ PERFORMANCE
Latency 320ms
Assessment ✓ Fast \

🔐 SECURITY
HTTPS ✓ Enabled
HSTS ⚠ Missing
Content-Security-Policy ⚠ Missing
X-Frame-Options ⚠ Missing
X-Content-Type-Options ✓ Present
Referrer-Policy ⚠ Missing \

🌐 CORS
Policy ⚠ Not detected

↪️ REDIRECTS
Status ✓ No redirect

🔧 HTTP METHODS
Allow ⚠ Not advertised

📊 RESPONSE ANALYSIS
Type json
Size 26.88 KB
JSON ✓ Valid
Structure array
Items 100
Keys userId, id, title, body

📄 CONTENT
Type application/json; charset=utf-8

────────────────────────────────────────
🔎 APILENS • Inspect. Understand. Debug.
──────────────────────────────────────── \

«Response times, headers, CORS policies, and other results will vary depending on the API being tested.»


CLI Options

Display the Help Menu

apilens --help

Display the Installed Version

apilens --version

Inspect an API

apilens <url>

Add a Custom Request Header

apilens <url> --header "Name: Value"

or:

apilens <url> -H "Name: Value"

Multiple Headers

Linux / macOS:

apilens
--header "X-Test: APILens"
--header "X-Environment: Development"

Windows PowerShell:

apilens --header "X-Test: APILens" --header "X-Environment: Development"


🧭 Why APILens?

When working with an unfamiliar API, developers often need to manually check multiple things:

  • Is the endpoint reachable?
  • How fast is it responding?
  • Is HTTPS enabled?
  • Which security headers are present?
  • Is CORS configured?
  • Did the server redirect the request?
  • What HTTP methods are advertised?
  • What type of data was returned?
  • Is the response valid JSON?
  • What does the response structure look like?

APILens brings these checks together into a single terminal command.

apilens https://api.example.com

Inspect the endpoint. Understand its behavior. Debug faster.


Notes

APILens is an inspection and debugging tool. Its results should be treated as diagnostic information rather than a complete security audit.

Network conditions, server configuration, API behavior, authentication requirements, rate limits, and other factors can affect the results returned by APILens.


🔎 APILens

Inspect. Understand. Debug.

Built for developers who want to understand their APIs without leaving the terminal.