canonical: https://jentic.com/apis/codescene.io/codescene

# CodeScene Public API

Jentic publishes the only available OpenAPI specification for CodeScene Public API, keeping it validated and agent-ready. CodeScene is a behavioural code analysis platform that combines code health scoring with author and team statistics, technical debt heatmaps, delta analyses on pull requests, and code coverage gating. The v2 API exposes 42 endpoints over api.codescene.io covering projects, repositories, full and delta analyses, components, files, commits, issues, technical debt, code coverage, and developer or team settings. Authentication is a Bearer token created in the CodeScene UI.

## For AI agents

Run and read CodeScene project analyses, technical debt, code health, and developer statistics for engineering productivity reporting.

## Scope

Does not handle on-prem CodeScene installation, billing, or single sign-on configuration - use for project, analysis, technical debt, and coverage data on cloud CodeScene only.

## Capabilities

- Trigger a fresh analysis on a CodeScene project via POST `/projects/{projectId}/run-analysis`
- Read the latest project analysis with GET `/projects/{projectId}/analyses/latest`, including code health and component breakdown
- Pull delta analysis results for pull request gating via GET `/projects/{projectId}/delta-analyses/{deltaAnalysisId}`
- Inspect technical debt friction by component via GET `/projects/{projectId}/analyses/{analysisId}/technical-debt`
- Track author and branch statistics across an analysis to surface knowledge silos and onboarding risk
- Manage code coverage gate results with GET /code-coverage and the gate-results endpoints
- Define architectural components on a project so analyses report code health per logical area

## Use cases

### Pull Request Risk Gating with Delta Analysis

Run CodeScene's delta analysis on every pull request and gate merges on the resulting risk score. The agent calls GET `/projects/{projectId}/delta-analyses` to find the analysis matching a PR commit, reads the score, and posts a status check back to the SCM. Catches risky changes before they land instead of after a postmortem.

Example prompt: Find the delta analysis for commit abc123, read the risk score, and if it exceeds 7 post a failing status check on the corresponding GitHub pull request

### Technical Debt Heatmap for Refactoring

Generate a technical debt heatmap by reading GET `/projects/{projectId}/analyses/{analysisId}/technical-debt` and joining it with file-level data. The agent ranks components and files by friction score so a refactoring sprint targets the highest-leverage areas. Replaces gut-feel debate about where to invest engineering time.

Example prompt: Pull the latest analysis id, then call GET `/projects/{projectId}/analyses/{analysisId}/technical-debt` and produce a top-10 list of components by friction

### Engineering Productivity Reporting

Build an engineering productivity report from CodeScene's author and branch statistics. The agent reads GET `/projects/{projectId}/analyses/{analysisId}/author-statistics` and GET `/projects/{projectId}/analyses/{analysisId}/branch-statistics` to produce metrics on contributor count, knowledge concentration, and delivery cadence. Powers monthly reviews without manual chart-building.

Example prompt: For project 'platform' fetch author-statistics for the latest analysis and email a CSV ranked by lines-changed-last-30-days

### Code Coverage Gate Monitoring

Use the code coverage gate-results endpoints to track whether builds are meeting coverage targets across a portfolio. The agent calls GET `/code-coverage/projects/{projectId}/gate-results/outcomes` per project and flags any gate that failed in the last 24 hours. Keeps coverage commitments honest without each team having to surface their own status.

Example prompt: For every project list outcomes via GET `/code-coverage/projects/{projectId}/gate-results/outcomes` for the last 24h and post any failed gates to a Slack channel

### Agent-Driven CodeScene Lookups via Jentic

An agent connected to Jentic can answer 'how healthy is the payments service?' by triggering a fresh analysis or reading the latest one without holding the raw API token. Jentic stores the CodeScene Bearer token in its vault and exposes the operations through intent search so the agent can search, load, and execute in seconds.

Example prompt: Search Jentic for 'get latest CodeScene analysis', load the GET `/projects/{projectId}/analyses/latest` schema, execute it for the payments project, and return the headline code health score

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/projects` | List CodeScene projects |
| POST | `/projects/new` | Create a new project |
| POST | `/projects/{projectId}/run-analysis` | Trigger an analysis |
| GET | `/projects/{projectId}/analyses/latest` | Get the latest analysis |
| GET | `/projects/{projectId}/analyses/{analysisId}/technical-debt` | Get technical debt friction |
| GET | `/projects/{projectId}/delta-analyses/{deltaAnalysisId}` | Get delta analysis details |
| GET | `/projects/{projectId}/analyses/{analysisId}/author-statistics` | Get author statistics |
| GET | `/code-coverage/projects/{projectId}/gate-results/outcomes` | Get code coverage gate outcomes |

## Key resources

- **Projects** — List, create, retrieve, and delete CodeScene projects and configure their architectural components
- **Repositories** — Add, list, edit, and remove git repositories under a project
- **Analyses** — Run analyses and read full analysis details, files, components, commits, issues, and statistics
- **Delta Analyses** — List and read delta analyses for pull request and pre-merge gating
- **Technical Debt** — Pull friction scores per component and file
- **Code Coverage** — Read coverage data and gate-result outcomes and insights
- **Developer Settings** — Manage developers and teams under each developer setting
- **Badges** — Read and update badge configuration for project status displays

## Why Jentic

- **Setup:** Wiring the CodeScene Public API by hand means building its Bearer header, targeting api.codescene.io/v2, and threading projectId and analysisId through every technical-debt and coverage read yourself. Through Jentic you install once, import the CodeScene Public API from the API Directory, store the Bearer token once, and your agent calls it.
- **Permission scoping:** CodeScene puts the project id in the URL path (`/projects/{projectId}/analyses/...` and `/code-coverage/projects/{projectId}/...`), so a rule can pin your agent to one project: it reads that project's analyses, technical debt, author statistics, and coverage outcomes and nothing else. You choose the operations it may call, so triggering a new analysis or creating a project is only in the allowed set if you add it.
- **Credential handling:** Your CodeScene token is stored once, encrypted, by your own Jentic One instance and injected at execution time as the Bearer token. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'get CodeScene technical debt' or 'read the latest analysis for a project', and Jentic returns the matching operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **SonarCloud API** — Static analysis platform with code quality and security rules running in the cloud
- **Code Climate Quality API** — Maintainability and issue tracking with comparable file-level metrics
- **GitHub API** — Pair with CodeScene to post analysis-derived status checks and comments on pull requests

## FAQ

### Why is there no official OpenAPI spec for CodeScene Public API?

CodeScene does not publish a public OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call CodeScene Public API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the CodeScene Public API use?

The CodeScene Public API uses HTTP Bearer authentication. Create an API token inside the CodeScene UI and send it as Authorization: Bearer {token}. Through Jentic the token is stored in the vault and never enters agent context.

### Can I trigger an analysis through the CodeScene API?

Yes. POST `/projects/{projectId}/run-analysis` kicks off a fresh analysis for the specified project. The endpoint is asynchronous, so poll GET `/projects/{projectId}/analyses/latest` until the new analysis id appears with a completed status.

### What are the rate limits for the CodeScene Public API?

CodeScene does not publish a fixed public rate limit, and limits depend on plan tier. Treat the API as best-effort and back off on HTTP 429 responses. For portfolio-wide reporting, throttle requests and rely on the latest analysis cache rather than triggering new runs each call.

### How do I read delta analysis results for a pull request through Jentic?

Search Jentic for 'get CodeScene delta analysis', load the GET `/projects/{projectId}/delta-analyses/{deltaAnalysisId}` schema, and execute it with the relevant ids. Jentic injects the Bearer token from the vault and returns the parsed risk score and detail.

### Does the CodeScene Public API include code coverage data?

Yes. The /code-coverage endpoints expose stored coverage data as well as gate-result outcomes and insights at `/code-coverage/projects/{projectId}/gate-results/.` The data is uploaded by CI integrations rather than pulled live from a coverage tool.

### Can I limit what my agent is allowed to do with the CodeScene Public API?

Yes. Because you run Jentic One yourself, your own rules decide which CodeScene operations and credentials the agent may use. CodeScene puts the project id in the URL path, such as `/projects/{projectId}/analyses`/ and `/code-coverage/projects/{projectId}`/, so a rule can pin the agent to a single project where it reads that project's analyses, technical debt, author statistics, and coverage outcomes and nothing else. You also choose the operations it may call, so write actions like triggering a new analysis via POST `/projects/{projectId}/run-analysis` or creating a project are only reachable if you add them to the allowed set.
