{
  "openapi": "3.1.0",
  "info": {
    "title": "Envelope by EpochCore",
    "version": "1.0.0",
    "description": "Hybrid Ed25519 + ML-DSA-65 post-quantum envelope for AI agent decisions.",
    "contact": {
      "email": "support@epochcoreqcs.com"
    },
    "license": {
      "name": "Apache-2.0 (SDK)",
      "url": "https://github.com/QuantumSwarms/envelope-sdk/blob/main/LICENSE"
    }
  },
  "servers": [
    {
      "url": "https://api.epochcoreqcs.com/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/envelope": {
      "post": {
        "summary": "Create a sealed envelope for an agent decision",
        "operationId": "createEnvelope",
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "agent_id",
                  "decision"
                ],
                "properties": {
                  "agent_id": {
                    "type": "string",
                    "example": "my-agent"
                  },
                  "decision": {
                    "type": "object",
                    "additionalProperties": true,
                    "example": {
                      "text": "agent response"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Envelope created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid x-api-key"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "Envelope": {
        "type": "object",
        "required": [
          "envelope_id",
          "status",
          "decision_hash",
          "agent_id",
          "compliance",
          "trust",
          "receipt"
        ],
        "properties": {
          "envelope_id": {
            "type": "string",
            "example": "dkap_env_01KRH6ZW5PANQTXG6X68F1K8XN"
          },
          "status": {
            "type": "string",
            "example": "verified"
          },
          "decision_hash": {
            "type": "string",
            "example": "sha256:cbbbdcd2…"
          },
          "agent_id": {
            "type": "string",
            "example": "my-agent"
          },
          "compliance": {
            "type": "object",
            "properties": {
              "dkap_stamped": {
                "type": "boolean"
              },
              "policy": {
                "type": "string"
              },
              "audit_ready": {
                "type": "boolean"
              }
            }
          },
          "trust": {
            "type": "object",
            "properties": {
              "identity_verified": {
                "type": "boolean"
              },
              "provenance_verified": {
                "type": "boolean"
              },
              "tamper_evidence": {
                "type": "boolean"
              },
              "package_bound": {
                "type": "boolean"
              },
              "pqc_ready": {
                "type": "boolean"
              }
            }
          },
          "receipt": {
            "type": "object",
            "properties": {
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "verdict": {
                "type": "string",
                "example": "release_ready"
              },
              "appendix_level": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}