Skip to main content

Get Security Exceptions

GET
endpoint
/api/stats/security/exceptions
Get the links with the most security violations or failed access attempts. Useful for identifying potentially problematic or heavily targeted links.

Query Parameters

limit
int
default:"5"
Maximum number of results to return

Response

Returns an array of security exception records ordered by count (highest first):
shortCode
string
required
The short code of the link with security exceptions
count
long
required
Number of security exceptions for this link
[
  {
    "shortCode": "abc123",
    "count": 47
  },
  {
    "shortCode": "xyz789",
    "count": 32
  },
  {
    "shortCode": "def456",
    "count": 28
  },
  {
    "shortCode": "ghi789",
    "count": 19
  },
  {
    "shortCode": "jkl012",
    "count": 12
  }
]

Example Request

curl -X GET "http://localhost:8080/api/stats/security/exceptions?limit=10"

GET
endpoint
/api/stats/links
Get counts of links grouped by their current status. Provides an overview of your link inventory.

Response

active
long
required
Number of currently active links
expired
long
required
Number of expired links
revoked
long
required
Number of revoked links
{
  "active": 342,
  "expired": 156,
  "revoked": 23
}

Example Request

curl -X GET "http://localhost:8080/api/stats/links"

GET
endpoint
/api/stats/links/top
Get the most accessed links ordered by access count. Identify your most popular content.

Query Parameters

limit
int
default:"5"
Maximum number of results to return

Response

Returns an array of top link records ordered by access count (highest first):
shortCode
string
required
The short code of the link
accessCount
long
required
Total number of accesses for this link
[
  {
    "shortCode": "popular1",
    "accessCount": 1523
  },
  {
    "shortCode": "trending2",
    "accessCount": 1247
  },
  {
    "shortCode": "viral3",
    "accessCount": 982
  },
  {
    "shortCode": "shared4",
    "accessCount": 756
  },
  {
    "shortCode": "common5",
    "accessCount": 634
  }
]

Example Request

curl -X GET "http://localhost:8080/api/stats/links/top?limit=20"

Use Cases

Use the top links endpoint to understand which content resonates most with your audience:
const topLinks = await fetch('/api/stats/links/top?limit=10')
  .then(res => res.json());

// Analyze patterns in popular links
topLinks.forEach(link => {
  console.log(`${link.shortCode}: ${link.accessCount} accesses`);
});

Security Monitoring Dashboard

Combine security exceptions with failure data to monitor potential attacks:
const [exceptions, failures] = await Promise.all([
  fetch('/api/stats/security/exceptions?limit=10'),
  fetch('/api/stats/access/failures')
]);

// Alert if any link has excessive security exceptions
const securityThreshold = 50;
const problematicLinks = exceptions.filter(e => e.count > securityThreshold);
Monitor the health of your link inventory:
const linkStats = await fetch('/api/stats/links')
  .then(res => res.json());

const total = linkStats.active + linkStats.expired + linkStats.revoked;
const activePercentage = (linkStats.active / total) * 100;

console.log(`Active links: ${activePercentage.toFixed(2)}%`);

Build docs developers (and LLMs) love