All jobs

List Every API Endpoint in an ASP.NET Core App

An agent maps the 20 API endpoints of an ASP.NET Core minimal-API app, finds 7 anonymous, and confirms all 13 protected routes answer 401.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent starts at src/Web/Program.cs:45, where app.MapEndpoints(typeof(Program).Assembly) registers every IEndpointGroup, then reads the four groups under src/Web/Endpoints/ and the helpers in src/Web/Infrastructure/. TodoItems.cs:13 puts RequireAuthorization() on the whole group, and Users.cs:12 calls MapIdentityApi, so 10 of the 11 Users routes come from the framework and have no handler file in the repository; logout is the repo's own handler at Users.cs:14.

It then reads AuthorizationBehaviour in the Application layer: it acts only on requests marked [Authorize], and only GetTodosQuery is. It compares its table with the OpenAPI document the build writes to src/Web/wwwroot/openapi/v1.json, starts the app in Development against a SQLite file, and calls every route without credentials. The repository is left untouched.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Write endpoints.md for this ASP.NET Core repository: every HTTP method and path, the registration line and handler file:line, path, query and body parameters, authentication, roles and policies. Follow endpoint groups, custom mapping helpers and framework-generated identity routes, and check the table against the OpenAPI document the build generates. Build with the SDK in global.json and run the unit and functional tests. Start a local Development instance on a throwaway SQLite database and call every route without credentials, recording the status. Report the endpoint count and which routes are anonymous. Do not edit the repository. If a pull request follows this prompt, check out its head first and name the commit you inventoried.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

Tried on jasontaylordev/CleanArchitecture at 8320b65: no code change, an endpoints.md with 20 endpoints under /api (TodoItems 4, TodoLists 4, WeatherForecasts 1, Users 11), 7 of them anonymous identity routes. That matches the 20 operations in the generated OpenAPI document. dotnet build CleanArchitecture.slnx ended Build succeeded. with 0 warnings, and the functional tests reported Passed! - Failed: 0, Passed: 19, Skipped: 0, Total: 19. All 13 protected routes answered 401 without a token.

For the reviewer: the 7 anonymous routes answered 500 because the probe sent empty {} bodies, so a successful register or login was never tested. Infrastructure.IntegrationTests and Web.AcceptanceTests were not run.

Run it on every pull request labelled api

An automation with a github trigger on pull_request.labeled and the label api runs this prompt with the pull request added after it. A new IEndpointGroup that forgets RequireAuthorization() shows up as a route that answers something other than 401.

The use case this job follows, with its automation and trigger: Produce a report or file, no repo.

Why run it on Rush?

Routes come from endpoint groups and from MapIdentityApi, not from controller attributes. The run also found that the Administrator role exists but no route or request uses it, and that every protected route needs only a signed-in user.

Frequently asked questions

Does the report change with the template options?

Yes. The checkout compiles the cookie-auth branch of #if (!UseApiOnly) in Web.csproj. A project generated with UseApiOnly uses bearer tokens and adds a / redirect to /scalar, so its report would differ there.

Why did the app need a connection string?

It refused to start with Connection string 'CleanArchitectureDb' not found. The agent passed a SQLite file through an environment variable rather than editing appsettings, so the repository stayed clean.

More ASP.NET Core jobs

The same job on other stacks

Keep reading