Skip to main content
POST
/
v1
/
analysis
/
test-coverage-map
cURL
curl -X POST 'https://api.supermodeltools.com/v1/analysis/test-coverage-map' \
  -H 'Idempotency-Key: <idempotency-key>' \
  -H 'X-Api-Key: <api-key>' \
  -F 'file=@/path/to/your/repo-snapshot.zip;type=application/zip'
import requests

url = "https://api.supermodeltools.com/v1/analysis/test-coverage-map"

files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-Api-Key": "<api-key>"
}

response = requests.post(url, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('file', '<string>');

const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', 'X-Api-Key': '<api-key>'}
};

options.body = form;

fetch('https://api.supermodeltools.com/v1/analysis/test-coverage-map', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.supermodeltools.com/v1/analysis/test-coverage-map",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data; boundary=---011000010111000001101001",
"Idempotency-Key: <idempotency-key>",
"X-Api-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.supermodeltools.com/v1/analysis/test-coverage-map"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.supermodeltools.com/v1/analysis/test-coverage-map")
.header("Idempotency-Key", "<idempotency-key>")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.supermodeltools.com/v1/analysis/test-coverage-map")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{
  "status": "completed",
  "jobId": "abc-123-def",
  "result": {
    "metadata": {
      "totalFiles": 142,
      "testFiles": 28,
      "productionFiles": 114,
      "totalFunctions": 891,
      "testedFunctions": 342,
      "untestedFunctions": 549,
      "coveragePercentage": 38.4,
      "analysisMethod": "static_call_graph_test_reachability",
      "analysisStartTime": "2026-02-09T12:00:00Z",
      "analysisEndTime": "2026-02-09T12:01:00Z"
    },
    "untestedFunctions": [
      {
        "file": "src/services/billing.ts",
        "name": "calculateRefund",
        "line": 89,
        "type": "function",
        "confidence": "high",
        "reason": "No test file calls this function directly or transitively"
      }
    ],
    "testedFunctions": [
      {
        "file": "src/services/billing.ts",
        "name": "calculateTotal",
        "line": 45,
        "type": "function",
        "testFiles": [
          "tests/billing.test.ts"
        ],
        "directTestCallers": 3,
        "transitiveTestCallers": 7
      }
    ],
    "testFiles": [
      {
        "file": "tests/billing.test.ts",
        "testFunctions": 12,
        "productionFunctionsCovered": 8,
        "productionFilesCovered": 3
      }
    ],
    "coverageByFile": [
      {
        "file": "src/services/billing.ts",
        "totalFunctions": 12,
        "testedFunctions": 8,
        "untestedFunctions": 4,
        "coveragePercentage": 66.7
      }
    ]
  }
}
{
"status": "processing",
"jobId": "abc-123-def",
"retryAfter": 5
}
{
"status": 400,
"code": "invalid_request",
"message": "Missing required query parameter 'repo'.",
"timestamp": "2025-02-05 16:35:12.000000000 Z",
"requestId": "req_01HZYJ9CE0ABCDEF1234",
"details": [
{
"field": "repo",
"issue": "This field is required.",
"location": "query"
}
]
}
{
"status": 401,
"code": "unauthorized",
"message": "Provide a valid OAuth token to access this resource.",
"timestamp": "2025-02-05 16:35:12.000000000 Z",
"requestId": "req_01HZYJ9CE0ABCDEFXYZ1"
}
{
"status": 403,
"code": "forbidden",
"message": "The token lacks the required keys:write scope.",
"timestamp": "2025-02-05 16:35:12.000000000 Z",
"requestId": "req_01HZYJ9CE0ABCDEFFORB"
}
{
"status": 429,
"code": "rate_limit_exceeded",
"message": "Too many requests. Try again after the reset window.",
"timestamp": "2025-02-05 16:35:12.000000000 Z",
"requestId": "req_01HZYJ9CE0ABCDEFRATE"
}
{
"status": 500,
"code": "internal_error",
"message": "Unexpected error processing request. Please retry.",
"timestamp": "2025-02-05 16:35:12.000000000 Z",
"requestId": "req_01HZYJ9CE0ABCDEFFAIL"
}
{
"status": 349,
"code": "<string>",
"message": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"requestId": "<string>",
"details": [
{
"field": "<string>",
"issue": "<string>",
"location": "<string>"
}
]
}

Authorizations

X-Api-Key
string
header
required

API key issued by the control plane for accessing data plane resources.

Headers

Idempotency-Key
string
required

Unique identifier for this request for idempotency and tracing.

Body

multipart/form-data
file
file
required

Zipped repository archive containing the code to analyze.

Response

Test coverage map (job completed)

Async response envelope for test coverage map operations.

status
enum<string>
required

Current status of the job.

Available options:
pending,
processing,
completed,
failed
jobId
string
required

Unique identifier for the job.

retryAfter
integer<int32>

Recommended seconds to wait before polling again.

error
string

Error message (present when status is failed).

result
object

The result (present when status is completed).