{
  "contract_version": "1.0.0",
  "production_api_base": "https://app.midfleet.ai",
  "development_api_base": "https://app.midfleet.io",
  "authentication": {
    "header": "X-API-Key",
    "project_placeholder": "<project-id>",
    "key_placeholder": "<midfleet-api-key>"
  },
  "discovery": {
    "openapi": "/openapi.json",
    "authenticated_contract": "/api/v1/contract",
    "explorer": "/api-docs"
  },
  "scope_profiles": {
    "readOnly": [
      "workflow-contracts:read"
    ],
    "author": [
      "workflow-contracts:read",
      "workflow-contracts:write"
    ],
    "invoker": [
      "workflow-contracts:read",
      "workflows:run",
      "workflows:read"
    ],
    "resultConsumer": [
      "workflows:read",
      "workflow-artifacts:read"
    ],
    "artifactPublisher": [
      "workflow-artifacts:write"
    ],
    "schemaAuthor": [
      "artifact-schemas:read",
      "artifact-schemas:write"
    ],
    "deliveryManager": [
      "workflow-delivery:manage"
    ],
    "controller": [
      "workflows:cancel"
    ]
  },
  "lifecycle": [
    {
      "step": "resolve",
      "method": "POST",
      "path": "/api/v1/projects/{projectId}/workflow/resolve-intent",
      "scopes": [
        "workflow-contracts:read"
      ],
      "creates_state": false
    },
    {
      "step": "preflight",
      "method": "POST",
      "path": "/api/v1/projects/{projectId}/workflow/preflight",
      "scopes": [
        "workflow-contracts:read"
      ],
      "creates_state": false
    },
    {
      "step": "invoke",
      "method": "POST",
      "path": "/api/v1/projects/{projectId}/workflow/invocations",
      "scopes": [
        "workflow-contracts:read",
        "workflows:run"
      ],
      "creates_state": true,
      "required_headers": [
        "Idempotency-Key"
      ],
      "optional_headers": [
        "X-Correlation-ID"
      ]
    },
    {
      "step": "launch",
      "method": "POST",
      "path": "/api/v1/projects/{projectId}/workflow/invocations/{invocationId}/launch",
      "scopes": [
        "workflows:run"
      ],
      "creates_state": true
    },
    {
      "step": "status",
      "method": "GET",
      "path": "/api/v1/projects/{projectId}/workflow/invocations/{invocationId}",
      "scopes": [
        "workflows:read"
      ],
      "creates_state": false
    },
    {
      "step": "artifact",
      "method": "GET",
      "path": "/api/v1/projects/{projectId}/workflow/invocations/{invocationId}/artifact",
      "scopes": [
        "workflow-artifacts:read"
      ],
      "creates_state": false
    }
  ],
  "examples": {
    "generic_engineering": {
      "resolve_request": {
        "intent": "Review the repository authentication boundary",
        "required_capabilities": [
          "analysis",
          "review"
        ],
        "metadata": {
          "source_app": "example-service",
          "source_route": "security.review"
        }
      },
      "invocation_request": {
        "intent": "Review the repository authentication boundary",
        "required_capabilities": [
          "analysis",
          "review"
        ]
      }
    },
    "trading_os_market_lens": {
      "resolve_request": {
        "intent": "Create today market lens briefing",
        "required_capabilities": [
          "market_analysis",
          "macro_research"
        ],
        "metadata": {
          "source_app": "trading-os",
          "source_route": "market_lens.run"
        }
      },
      "invocation_request": {
        "intent": "Create today market lens briefing",
        "workflow_template_key": "market_lens_briefing",
        "workflow_template_version": "1.0.0",
        "required_capabilities": [
          "market_analysis",
          "macro_research"
        ]
      }
    }
  },
  "compatibility": {
    "no_match": "matched=false; no workflow state is created",
    "generic_control": "Generic Control can still create drafts, but project invocation launch requires an explicit matched contract.",
    "model_assistance": "Deterministic rules are authoritative. Model-assisted routing is optional, governed, and budget-capped."
  },
  "versioning": {
    "policy": "additive-with-semver-contract-versions",
    "deprecation_notice_days": 90,
    "changelog": "https://midfleet.io/docs/changelog/"
  }
}
