External API

Reference for the Codeego external API: authentication with OAuth 2.0 client credentials, the endpoints to create and read assessments, modes and quotas, rate limits, errors, and how API keys are managed.

The external API lets a system create assessments of Git repositories and read their results without using the web app. Assessments created through the API belong to your organisation and appear on its dashboard with the name of the API key that created them. For results pushed to you on completion, see Webhooks.

The base URL is https://backend.codeego.com. All endpoints are under /api/external/v1, accept and return JSON, and require HTTPS.

Getting access#

API access is enabled per organisation by Codeego, on request. Once it is enabled, Owners and Admins see an API Keys tab in Settings. The tab does not appear for organisations without API access, or for Members and Viewers.

Manage API keys#

An API key is a pair of credentials, a client_id and a client_secret, that belongs to the organisation. In Settings, API Keys:

  • Create API Key asks for a name (3 to 120 characters) and shows the client ID and the secret. The secret is shown only once. Store it in a secret manager.
  • The list shows each key's Name, Prefix, Owner (the person who created it), Created, Last Used and Status (Active or Revoked).
  • Rotate key issues a new secret for the same client ID. The previous secret keeps working for 24 hours, so that you can deploy the new one without interruption.
  • Revoke key disables the key at once. Tokens already issued for it can no longer create assessments.
  • The usage panel shows the Current month quota consumption for each mode.

Authentication#

The API uses the OAuth 2.0 client credentials grant. Exchange the key for an access token, then send the token in the Authorization header as Bearer <token>. Tokens are valid for one hour (3,600 seconds). There are no refresh tokens: request a new token when the current one expires. Treat tokens as secrets: do not log them or send them to browser code.

curl -X POST https://backend.codeego.com/api/external/v1/auth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET"
  }'
POST /api/external/v1/auth/token. The body may also be sent as application/x-www-form-urlencoded.
{
  "access_token": "eyJ...",
  "token_type": "Bearer",
  "expires_in": 3600
}
Response 200

Create an assessment#

POST /api/external/v1/assessments queues an assessment and returns immediately. The run is charged to the organisation's monthly quota for the requested mode, not paid by card.

curl -X POST https://backend.codeego.com/api/external/v1/assessments \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "repository_url": "https://github.com/your-org/your-repo",
    "branch": "main",
    "mode": "starter",
    "team_location": "western_eu",
    "webhook_url": "https://example.com/codeego/webhook"
  }'
{
  "id": "019524ab-7c1e-7d2a-9b1f-3a6c2e8d4f10",
  "status": "queued",
  "mode": "starter",
  "created_at": "2026-11-20T10:15:00+00:00",
  "_links": {
    "self": "/api/external/v1/assessments/019524ab-7c1e-7d2a-9b1f-3a6c2e8d4f10"
  }
}
Response 201
FieldTypeDefaultDescription
modestringrequiredstarter or expert. See Modes and quotas.
repository_urlstringURL of one public repository. Use this or repositories.
branchstringdefault branchBranch to analyse.
commit_shastringAnalyse a specific commit.
repositoriesarraySeveral repositories analysed as one assessment. Each element has url (required), branch and name.
work_modestringcorporatestartup, scaleup, corporate or enterprise. See The team scenario.
team_locationstringwestern_euus_north_eu, western_eu, southern_eu, eastern_eu, latam or asia.
ai_adoptionstringtraditionaltraditional, ai_assisted or ai_augmented.
include_economic_valuationbooleantrueProduce the economic report and estimates.
titlestringLabel for the assessment, up to 100 characters.
notesstringContext for the assessment, up to 5,000 characters.
webhook_urlstringHTTPS URL that receives the completion event, up to 2,048 characters. See Webhooks.

The request only checks that the URL is well formed and on a supported host. A repository that cannot be cloned (private, misspelt or deleted) produces an assessment that ends with status failed.

Read an assessment#

GET /api/external/v1/assessments/{id} returns the current state. Only assessments created through the API or the CLI by your organisation can be read; any other ID returns 404. Poll until status is completed or failed. No Retry-After header is sent while a run is in progress; an interval of a few seconds to a minute is reasonable, and most runs finish within the hour.

queued
Accepted and waiting to start.
running
Being analysed. progress gives a percentage from 0 to 100 when available. A run whose report is still being stored reports running with progress 99.
completed
Finished. results is present.
failed
Finished without results. error contains code (analysis_failed) and a message.
{
  "id": "019524ab-7c1e-7d2a-9b1f-3a6c2e8d4f10",
  "status": "completed",
  "mode": "starter",
  "created_at": "2026-11-20T10:15:00+00:00",
  "started_at": "2026-11-20T10:15:04+00:00",
  "finished_at": "2026-11-20T10:41:37+00:00",
  "progress": 100,
  "error": null,
  "results": {
    "kpis": { "...": "scores, findings and estimates" },
    "report_url": "https://storage.googleapis.com/...",
    "report_url_expires_at": "2026-11-20T11:45:12+00:00",
    "economic_report_url": "https://storage.googleapis.com/...",
    "economic_report_url_expires_at": "2026-11-20T11:45:12+00:00",
    "certificate_url": "https://storage.googleapis.com/...",
    "certificate_url_expires_at": "2026-11-20T11:45:12+00:00",
    "technical_report_md_url": "https://storage.googleapis.com/...",
    "technical_report_md_url_expires_at": "2026-11-20T11:45:12+00:00",
    "economic_report_md_url": "https://storage.googleapis.com/...",
    "economic_report_md_url_expires_at": "2026-11-20T11:45:12+00:00"
  }
}
Response 200 for a completed assessment (values shortened)

kpis holds the structured results: scores, findings and, when requested, the economic estimates. report_url is the technical report as PDF; the economic report, the Evidence Certificate and Markdown versions of the reports are given when they exist, otherwise null. Every URL is signed and expires one hour after the response. Request the assessment again to obtain fresh URLs.

Modes and quotas#

mode selects the plan level of the run: starter runs the assessment at Starter level, expert at Expert level. Both use the same analysis method and the same reproducibility controls (see Determinism and reproducibility). They differ in what the plan includes, as described in Plans and what they include.

Each organisation has a monthly quota per mode, agreed when API access is enabled. If the quota is reached and no overage has been agreed, creation fails with 429 and code quota_exceeded, and details gives the mode, the number used and the quota. If overage has been agreed, the run proceeds and is billed as overage. Quotas reset at the start of each calendar month (UTC).

Rate limits#

EndpointLimit per client IP address
POST /auth/token10 requests per minute
POST /assessments60 requests per minute
GET /assessments/{id}600 requests per minute

A request over the limit receives status 429. Its body differs from the error envelope below; rely on the status code, honour a Retry-After header if present, and back off exponentially from one second.

Errors#

{
  "error": {
    "code": "quota_exceeded",
    "message": "monthly starter quota of 50 exceeded",
    "details": { "mode": "starter", "used": 50, "quota": 50 }
  }
}
Error envelope. details is present only for some errors.
StatusCodeMeaning
400invalid_requestMalformed body, missing or invalid field, webhook_url not HTTPS, unsupported repository URL.
401invalid_clientUnknown client_id or wrong client_secret.
401unauthorized_clientKey revoked, or API access not enabled or disabled for the organisation.
401invalid_tokenMissing, malformed or invalid bearer token.
401token_expiredThe token has expired. Request a new one.
404assessment_not_foundNo API or CLI assessment with this ID in your organisation.
429quota_exceededMonthly quota for the requested mode reached.