Skip to content
POST/api/v1/security/model-scan/upload

Upload model artifact for scanning

Multipart upload of a model file (.safetensors / .pkl / .pth / .gguf / .onnx) for in-memory scanning. Send `multipart/form-data` with a `projectId` text field and a `file` binary field, AND repeat the same project id as a `?projectId=` query parameter — the query value is what the membership gate can see for a multipart body, so a missing or mismatched pair returns 400 PROJECT_MISMATCH. Filename defaults to 'uploaded-model' when empty (e.g. curl multipart without a filename) and is truncated to 500 chars. Max size 500 MB, checked first against Content-Length before the body is buffered and again against the parsed file size (413 TOO_LARGE both times); host larger files and use the URL scan endpoint. The file is scanned in memory and never written to disk or retained; a SHA-256 of the bytes is recorded. Persists a `model_scans` row (format, verdict, severity counts, duration, sha256) plus up to 500 `model_scan_findings`, and returns 201 `{scanId, ...scanResult, sha256, filename}`. If the tables are not yet migrated the scan result is still returned with `migrationPending: true`. Requires `security_scans:create`; 10 req/min.

Authentication

Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/settings/api-keys.

Request body required

Schema
{
  "multipart/form-data": {
    "schema": {
      "type": "object",
      "properties": {
        "file": {
          "type": "string",
          "format": "binary"
        }
      }
    }
  }
}

Response

200 example

{
  "model_id": "00000000-0000-0000-0000-000000000000",
  "filename": "string"
}

All status codes

200Upload complete.
201Created.
400(no description)
401(no description)
403Forbidden — insufficient role for this operation.
409Conflict — CONFLICT.
413Payload too large (> 5GB).
429(no description)
500Internal Server Error — DB_ERROR.

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/security/model-scan/upload \
  -H "Authorization: Bearer $EVALGUARD_API_KEY"

TypeScript

// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:

const res = await fetch("https://evalguard.ai/api/v1/security/model-scan/upload", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}` },
});
console.log(res.status, await res.json());

Python

# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:

import os
import requests

headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}

response = requests.request("POST", "https://evalguard.ai/api/v1/security/model-scan/upload", headers=headers)
print(response.status_code, response.json())

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/security/model-scan/upload", nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401403409413429500

Other Security endpoints