Skip to main content
POST
/
v1
/
analysis
/
dead-code
cURL
curl -X POST 'https://api.supermodeltools.com/v1/analysis/dead-code' \
  -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/dead-code"

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/dead-code', 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/dead-code",
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/dead-code"

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/dead-code")
.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/dead-code")

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": {
      "totalDeclarations": 162,
      "deadCodeCandidates": 102,
      "aliveCode": 60,
      "analysisMethod": "parse_graph + call_graph",
      "analysisStartTime": "2025-02-05T15:42:05Z",
      "analysisEndTime": "2025-02-05T15:42:10Z"
    },
    "deadCodeCandidates": [
      {
        "file": "src/utils/idGenerator.ts",
        "name": "generateSequentialId",
        "line": 8,
        "type": "function",
        "confidence": "high",
        "reason": "No callers found in codebase"
      }
    ],
    "aliveCode": [
      {
        "file": "src/index.ts",
        "name": "main",
        "line": 10,
        "type": "function",
        "callerCount": 3
      }
    ],
    "entryPoints": [
      {
        "file": "src/index.ts",
        "name": "main",
        "line": 10,
        "type": "function",
        "reason": "Module export"
      }
    ]
  }
}
{
"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

Dead code analysis (job completed)

Async response envelope for dead code analysis 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).