DiffCritic API

The DiffCritic REST API: authentication with an API key or OAuth, scopes, every operation and the per-user limits.

Authentication

Every request carries a bearer token in the Authorization header. Never put a credential in a URL.

API key

Create a key on API access in your dashboard, set it in your shell and send it:

curl -H "Authorization: Bearer $DIFFCRITIC_API_KEY" https://diffcritic.com/api/v1/me

OAuth

An app that acts for a person uses the authorization code flow with PKCE (S256) and public clients, with refresh tokens. The authorization server describes itself at https://diffcritic.com/.well-known/oauth-authorization-server and registers clients dynamically or reads a client ID metadata document. Ask for the resource https://diffcritic.com/api/ and for the scopes below. The person approves the request on a consent page and can revoke the connection on API access.

Scopes

read
See your DiffCritic accounts, repositories, jobs, reviews, scan results, usage and costs
write
Change the review and scan settings of your repositories
scans
Start paid repository security scans, each one only after you approve it in DiffCritic or within a spending limit you set

Operations

Each operation needs the scope named next to it. The OpenAPI document describes them for programs. Signed-in users find every operation on API access.

Request Scope What it does
GET /api/v1/me read The signed-in login and the customers this credential reaches.
GET /api/v1/customers read Customers this credential may access.
GET /api/v1/customers/{customer_id} read One customer's account state.
GET /api/v1/customers/{customer_id}/repositories read The customer's repositories, filtered and paged.
GET /api/v1/customers/{customer_id}/repositories/{repository_id} read One repository and its effective findings policy.
PATCH /api/v1/customers/{customer_id}/repositories/{repository_id} write Change the review type or security scan of one repository.
PUT /api/v1/customers/{customer_id}/repositories/{repository_id}/check-policy write Save the policy owner and the three findings pass overrides.
PATCH /api/v1/customers/{customer_id}/defaults write Change the defaults new repositories inherit.
POST /api/v1/customers/{customer_id}/repositories/bulk write Apply the same change to up to 200 repositories.
PUT /api/v1/me/check-defaults write Save your login's global findings defaults.
GET /api/v1/customers/{customer_id}/reviews read Pull request reviews of this customer, newest first.
GET /api/v1/customers/{customer_id}/reviews/{review_id} read One review of this customer.
GET /api/v1/customers/{customer_id}/usage read This month's usage: review units and scans.
GET /api/v1/customers/{customer_id}/billing-histories read Archived billing namespaces of this customer.
GET /api/v1/customers/{customer_id}/costs read One month's costs by repository, PR and commit.
GET /api/v1/customers/{customer_id}/scans read Repository scans of this customer, newest first.
GET /api/v1/customers/{customer_id}/scans/{scan_id} read One repository scan, with or without a readable report.
GET /api/v1/customers/{customer_id}/scans/{scan_id}/report read One page of a scan's findings.
POST /api/v1/customers/{customer_id}/scans/previews scans Price a scan of the default branch's current commit and get the link that approves it. Accepts and charges nothing.
POST /api/v1/customers/{customer_id}/scans scans Start a previewed paid scan within this credential's paid grant; without one, answers the approval link.

Limits

Limits apply per login: all of its keys and connected apps share the key cap and the concurrent-request count of the MCP server.

Active API keys per login
10
Default lifetime of a key, in days
90
Longest lifetime of a key, in days
365
Read requests per minute, per key or app
120
Write requests per minute, per key or app
20
Scan requests per minute, per key or app
5
MCP requests per minute, per key or app
240
Requests running at once on the MCP server, per login
4

A request past a per-minute limit, or past the MCP requests one person may have running at once, is answered with 429 and a Retry-After header. When the MCP server as a whole is busy, a request is answered with 503 and a Retry-After header. A new key past the active-key limit is refused on the dashboard, and a key past its lifetime is answered with 401.