# Admin Feeds

Administrative endpoints for managing user feed caches. Provides tools for regenerating, clearing, and diagnosing cached home feeds stored in Redis. Feed regeneration recomputes the feed from the database and updates the cache. Requires Jobs.Manage permission.

## Clear user feed cache

 - [POST /api/v1/admin/feed/clear-user-feed](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1clear-user-feed/post.md): Removes cached feed data from Redis for specified user(s). If no user is specified, clears all cached feeds. Use with caution as this will force feed regeneration on next access. Returns the number of Redis keys deleted.

RBAC: requires Jobs.Manage

## Get exact cached post count for user feed

 - [GET /api/v1/admin/feed/count-user-feed](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1count-user-feed/get.md): Returns the exact number of cached posts currently stored in Redis for a user's home feed. Requires exactly one of userId or username.

RBAC: requires Jobs.Manage

## Diagnose user feed cache

 - [GET /api/v1/admin/feed/diagnose](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1diagnose/get.md): Compares the Redis-cached home feed against the database-generated feed for one or all recently active users. Returns detailed comparison results including exact match status, order mismatches, and missing/extra post IDs. Use filters to skip exact matches or order mismatches for easier debugging. Requires Jobs.Manage permission.

RBAC: requires Jobs.Manage

## Get metrics across all operations

 - [GET /api/v1/admin/feed/metrics/global-all-operation](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1global-all-operation/get.md): Retrieves global aggregated metrics across all feed operations within a time window.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get global aggregated metrics

 - [GET /api/v1/admin/feed/metrics/global-single](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1global-single/get.md): Retrieves global aggregated feed performance metrics for a specific operation within a time window. Includes average times, total measurements, and user counts.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get feed metrics history

 - [GET /api/v1/admin/feed/metrics/history](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1history/get.md): Retrieves historical feed performance metrics for a specific operation and user. Returns a list of feed metrics ordered by timestamp.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get comprehensive feed metrics

 - [GET /api/v1/admin/feed/metrics/history/all](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1history~1all/get.md): Retrieves complete feed metrics history for a user across all operations. Returns a map where keys are operation types and values are lists of feed metrics.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get user running average

 - [GET /api/v1/admin/feed/metrics/running-average-single](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1running-average-single/get.md): Retrieves the running average performance metrics for a specific user and operation within a sliding time window.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get all user running averages

 - [GET /api/v1/admin/feed/metrics/running-averages-all](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1running-averages-all/get.md): Retrieves running average performance metrics for a specific user across all feed operations.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Identify slowest feed operations

 - [GET /api/v1/admin/feed/metrics/slowest-operations](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1slowest-operations/get.md): Analyzes and ranks feed operations by their average execution time across all users. Helps identify performance bottlenecks.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Identify users with performance issues

 - [GET /api/v1/admin/feed/metrics/slowest-users](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1slowest-users/get.md): Analyzes and identifies users experiencing the slowest feed operation times. Can analyze a specific operation or aggregate across all operations.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get performance leaderboards for all operations

 - [GET /api/v1/admin/feed/metrics/slowest-users-all](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1slowest-users-all/get.md): Retrieves performance leaderboards for all feed operations. Returns a map of operations to ranked user lists.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get performance leaderboard

 - [GET /api/v1/admin/feed/metrics/slowest-users-single](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1slowest-users-single/get.md): Retrieves a ranked list of users by their feed operation performance for a specific operation. Can show either slowest or fastest users based on sort order.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get comprehensive metrics summary

 - [GET /api/v1/admin/feed/metrics/summary](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1summary/get.md): Generates a complete summary of feed performance metrics across all operations, including totals and averages.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get comprehensive user counts

 - [GET /api/v1/admin/feed/metrics/user-count-all](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1user-count-all/get.md): Returns user counts for all feed operations within the time window. Returns a map structure for comprehensive analysis.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Get active user count

 - [GET /api/v1/admin/feed/metrics/user-count-single](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1metrics~1user-count-single/get.md): Returns the count of unique users who performed a specific feed operation within the time window.

RBAC:
- requires ANY of Jobs.Read, Jobs.Manage

## Regenerate user feed cache

 - [POST /api/v1/admin/feed/regenerate-user-feed](https://docs.wellesley.social/openapi/admin-feeds/paths/~1api~1v1~1admin~1feed~1regenerate-user-feed/post.md): Forces regeneration of cached feed data for specified user(s). If no user is specified, regenerates feeds for all recently active users (signed in within the last period). Returns the number of feeds queued for regeneration.

RBAC: requires Jobs.Manage

