Back to KB
Difficulty
Intermediate
Read Time
4 min

/api/ai/review β€” Code Review Endpoint

By Codcompass TeamΒ·Β·4 min read

/api/ai/review β€” Code Review Endpoint

Overview

The /api/ai/review endpoint provides a lightweight, rule-based static analysis service for submitted source code. Designed as a fast-feedback mechanism, it scans code against a predefined set of language-specific patterns to identify common anti-patterns, style violations, and production-readiness issues. This endpoint is ideal for developers integrating automated code quality checks into CI/CD pipelines, IDE extensions, educational platforms, or internal developer tooling.

Unlike full abstract syntax tree (AST) parsers or large language model (LLM) integrations, this endpoint uses optimized regular expressions to deliver near-instant results. It currently supports TypeScript, JavaScript, Python, Go, and Rust. The response includes a calculated quality score, a human-readable summary, and a detailed list of flagged issues with actionable suggestions. While currently implemented as an MVP rule engine, the response structure is designed to remain backward-compatible when upgraded to more advanced analysis backends.

Endpoint Reference

  • URL Path: POST /api/ai/review
  • Base URL: https://codcompass.com
  • HTTP Method: POST
  • Authentication: Public (No API key, bearer token, or session required)
  • Content-Type: application/json
  • Expected Payload Size: Standard Next.js API route limits apply (typically ~4MB). For larger files, consider chunking or preprocessing.

Request Format

The endpoint expects a JSON payload containing the raw source code and an optional language identifier. All fields are case-sensitive and must be properly encoded.

FieldTypeRequiredDescription
codestringYesThe raw source code to analyze. Must be a valid string containing standard newline characters (\n).
`lan

πŸŽ‰ Mid-Year Sale β€” Unlock Full Article

Base plan from just $4.99/mo or $49/yr

Sign in to read the full article and unlock all 635+ tutorials.

Sign In / Register β€” Start Free Trial

7-day free trial Β· Cancel anytime Β· 30-day money-back

Sources

  • β€’ api-reference