POST /v1/dfm

Run DFM Analysis

Summary

Run DFM checks on a Gerber zip file

Description

Uploads a Gerber zip file, runs core DFM analysis, and returns a structured result with issues and board facts. This is the primary endpoint for programmatic DFM analysis. Accepts either a file upload or a previously uploaded board_id.

Request Example

# Option A: File upload
curl -X POST "http://127.0.0.1:8000/api/v1/dfm" \
  -H "Authorization: Bearer asap_dev_change_me" \
  -F "file=@board.zip" \
  -F 'options_json={"check_ids":null,"include_gerber_b64":false}'

# Option B: Using board_id
curl -X POST "http://127.0.0.1:8000/api/v1/dfm" \
  -H "Authorization: Bearer asap_dev_change_me" \
  -F "board_id=brd_1234567890abcdef" \
  -F 'options_json={"check_ids":null,"include_gerber_b64":false}'

Response Example

{
  "request_id": "req_1234567890abcdef",
  "result": {
    "summary": {
      "overall_score": 0.85,
      "issues_count": 2,
      "checks_run": 5,
      "area_sqin": 1.23,
      "confidence": 0.9
    },
    "issues": [
      {
        "code": "min_trace_width",
        "severity": "warning",
        "message": "Trace width below minimum requirement",
        "location": "Layer: F.Cu, X:1.23,Y:4.56",
        "check_id": "min_trace_width"
      }
    ],
    "area_sqin": 1.23
  }
}

Error Codes

This endpoint may return the following error codes:

Code Status Meaning
missing_auth 401 No Authorization header provided
invalid_api_key 403 API key is invalid or missing
invalid_file 400 Uploaded file is not a .zip file
empty_file 400 Uploaded file is empty
board_not_found 404 board_id not found
missing_input 400 Provide either file or board_id
dfm_failed 500 DFM analysis execution failed

Authentication

This endpoint requires Bearer token authentication:

Authorization: Bearer YOUR_API_KEY