{
  "openapi": "3.1.0",
  "info": {
    "title": "Forge Box API",
    "version": "0.1.0",
    "description": "Agent-ready infrastructure for SaaS.",
    "contact": {
      "email": "build@forgebox.ai"
    }
  },
  "servers": [
    {
      "url": "https://api.forgebox.ai/api/v1"
    }
  ],
  "paths": {
    "/auth/register": {
      "post": {
        "operationId": "register",
        "summary": "Create account",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "name"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          },
          "409": {
            "description": "Exists"
          }
        }
      }
    },
    "/auth/login": {
      "post": {
        "operationId": "login",
        "summary": "Login",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Get profile",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/workflows": {
      "get": {
        "operationId": "listWorkflows",
        "summary": "List workflows",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "operationId": "createWorkflow",
        "summary": "Create workflow",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "manifest"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "manifest": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/workflows/{id}": {
      "get": {
        "operationId": "getWorkflow",
        "summary": "Get workflow",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not found"
          }
        }
      },
      "put": {
        "operationId": "updateWorkflow",
        "summary": "Update workflow",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "operationId": "deleteWorkflow",
        "summary": "Delete workflow",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          }
        }
      }
    },
    "/workflows/{id}/execute": {
      "post": {
        "operationId": "executeWorkflow",
        "summary": "Execute workflow",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "parameters": {
                    "type": "object"
                  },
                  "dryRun": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": "OK"
            },
            "403": {
              "description": "Policy violation"
            }
          }
        }
      },
      "/sandbox/run": {
        "post": {
          "operationId": "runSandbox",
          "summary": "Run code in sandbox",
          "security": [
            {
              "bearerAuth": []
            }
          ],
          "requestBody": {
            "required": true,
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "stubCalls": {
                      "type": "array"
                    }
                  }
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": "OK"
            }
          }
        }
      },
      "/sandbox/stubs": {
        "get": {
          "operationId": "listStubs",
          "summary": "List stub APIs",
          "responses": {
            "200": {
              "description": "OK"
            }
          }
        }
      }
    },
    "components": {
      "securitySchemes": {
        "bearerAuth": {
          "type": "http",
          "scheme": "bearer"
        },
        "apiKeyAuth": {
          "type": "apiKey",
          "in": "header",
          "name": "Authorization"
        }
      }
    }
  }
}