GetCodeReviews
GetCodeReviews
Sign InStart Free →
REST API

API Reference

Integrate AI code reviews directly into your CI/CD pipeline using the GetCodeReviews REST API.

Authentication

All API requests require authentication via an API key. Pass your key using the x-api-key header.

bash
#0096ff">curl -X POST https://getcodereviews.com/api/review \
  -H #00e5a0">"Content-Type: application/json" \
  -H #00e5a0">"x-api-key: gcr_your_key_here" \
  -d '{
    #00e5a0">"code": "function add(a, b) { return a + b }",
    #00e5a0">"language": "javascript",
    #00e5a0">"source": "api"
  }'
EndpointPOST /api/reviewHeaderx-api-key: gcr_...Body: codeString — the source code to reviewBody: languageString — e.g. javascript, python, typescriptBody: source"api" — marks the review as API-originated

Response Format

A successful review returns a result object with a score, summary, and an array of issues.

json
{
  #00e5a0">"result": {
    #00e5a0">"score": 84,
    #00e5a0">"summary": "Good code with minor issues",
    #00e5a0">"issues": [
      {
        #00e5a0">"type": "warning",
        #00e5a0">"title": "Missing error handling",
        #00e5a0">"body": "The fetch call has no catch block",
        #00e5a0">"fix": "try { ... } catch(err) { console.error(err) }",
        #00e5a0">"line": 12
      },
      {
        #00e5a0">"type": "good",
        #00e5a0">"title": "Clear variable naming",
        #00e5a0">"body": "Variables are descriptive and follow conventions"
      }
    ]
  },
  #00e5a0">"usage": {
    #00e5a0">"used": 45,
    #00e5a0">"limit": 200,
    #00e5a0">"plan": "PRO"
  }
}
FieldTypeDescription
result.scorenumber0–100 quality score
result.summarystringOne-sentence summary
result.issuesarrayArray of issue objects
issues[].typestringcritical | warning | info | good
issues[].titlestringShort issue title
issues[].bodystringDetailed explanation
issues[].fixstring?Optional suggested fix code
issues[].linenumber?Optional line number
usage.usednumberReviews used this month
usage.limitnumberMonthly review limit

Quality Gate — GitHub Action

Add this workflow to your repository at .github/workflows/codescan.yml. Set CODESCAN_API_KEY in your repository secrets.

yaml
#0096ff">name: CodeScan AI Quality Gate
#0096ff">on:
  pull_request:
    types: [opened, synchronize]

#0096ff">jobs:
  quality-gate:
    runs-#0096ff">on: ubuntu-latest
    #0096ff">steps:
      - #0096ff">uses: actions/checkout@v4

      - #0096ff">name: Run CodeScan AI Quality Gate
        #0096ff">run: |
          # Get changed files and concatenate them
          CHANGED=$(git diff --#0096ff">name-only origin/${{ github.base_ref }}...HEAD \
            | grep -E '\.(js|ts|jsx|tsx|py|go|java|rb)$' \
            | head -5 | xargs cat 2>/dev/null || #0096ff">echo "")

          #0096ff">if [ -z "$CHANGED" ]; then
            #0096ff">echo "No reviewable files changed — skipping quality gate"
            #0096ff">exit 0
          #0096ff">fi

          RESPONSE=$(#0096ff">curl -s -X POST \
            https://getcodereviews.com/api/review \
            -H #00e5a0">"Content-Type: application/json" \
            -H #00e5a0">"x-api-key: ${{ secrets.CODESCAN_API_KEY }}" \
            -d #00e5a0">"{
              \"code\": $(#0096ff">echo "$CHANGED" | jq -Rs .),
              \"language\": \"javascript\",
              \"source\": \"api\"
            }")

          SCORE=$(#0096ff">echo "$RESPONSE" | jq -r '.result.score // 0')
          SUMMARY=$(#0096ff">echo "$RESPONSE" | jq -r '.result.summary // "No summary"')

          #0096ff">echo "Quality Score: $SCORE / 100"
          #0096ff">echo "Summary: $SUMMARY"

          #0096ff">if [ "$SCORE" -lt "$MIN_SCORE" ]; then
            #0096ff">echo "Quality gate FAILED: score $SCORE is below threshold $MIN_SCORE"
            #0096ff">exit 1
          #0096ff">fi

          #0096ff">echo "Quality gate PASSED"
        #0096ff">env:
          MIN_SCORE: 70
Tip: Set MIN_SCORE to match your quality gate threshold from your settings. Default is 70.

Rate Limits

PlanMonthly ReviewsRate Limit
FreeNo API access
Pro200 reviews/month60 requests / minute
Team1,000 reviews/month (shared)60 requests / minute

Monthly review counts reset on the 1st of each month. Rate limits apply per API key.

Error Codes

CodeMeaning
401Invalid or missing API key
403Plan does not include API access (Free plan)
400Invalid request body — code or language missing
429Rate limit exceeded or monthly review limit reached
500Internal server error — try again shortly