POST /v1/dfm-runs

Create DFM Run

Summary

Create an auditable DFM analysis run

Description

Runs DFM analysis on a board and stores the result with a unique dfm_run_id for audit trail. Supports idempotency for CI/CD reliability. Use this for production workflows where you need to track and reference specific DFM analyses.

Request Example

curl -X POST "http://127.0.0.1:8000/api/v1/dfm-runs" \
  -H "Authorization: Bearer $ASAP_API_KEY" \
  -H "Idempotency-Key: <stable-key>" \
  -F "board_id=brd_..." \
  -F 'options_json={"check_ids":null,"include_gerber_b64":false}'

Response Example

{
  "request_id": "req_1234567890abcdef",
  "dfm_run_id": "dfm_1234567890abcdef",
  "board_id": "brd_1234567890abcdef",
  "created_at": "2026-01-23T13:30:00Z",
  "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
invalid_options 400 options_json is not valid JSON for DfmOptions
dfm_failed 500 DFM execution failed

Authentication

This endpoint requires Bearer token authentication:

Authorization: Bearer YOUR_API_KEY