{
  "openapi": "3.1.0",
  "info": {
    "title": "Wardlace agent API",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://agents.steadyzinc.store"
    }
  ],
  "paths": {
    "/signup": {
      "post": {
        "operationId": "createSignup",
        "summary": "Get a test key",
        "description": "Issues a test API key. Nothing is charged.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "company": {
                    "type": "string"
                  },
                  "use_case": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "email",
                  "company",
                  "use_case"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "company": {
                    "type": "string"
                  },
                  "use_case": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "email",
                  "company",
                  "use_case"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Test key issued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "received"
                    },
                    "api_key": {
                      "type": "string",
                      "pattern": "^wdl_test_[a-z0-9]+$"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Fields missing or invalid; send the request again with them",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/bookings": {
      "post": {
        "operationId": "createBooking",
        "summary": "Book a call",
        "description": "Sends a request. Nothing is charged or confirmed until the request is answered by email.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offer": {
                    "type": "string",
                    "enum": [
                      "sales-call"
                    ]
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "time": {
                    "type": "string",
                    "pattern": "^[0-2][0-9]:[0-5][0-9]$"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "offer",
                  "date",
                  "time",
                  "name",
                  "email"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "offer": {
                    "type": "string",
                    "enum": [
                      "sales-call"
                    ]
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "time": {
                    "type": "string",
                    "pattern": "^[0-2][0-9]:[0-5][0-9]$"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "offer",
                  "date",
                  "time",
                  "name",
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Request received",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "received"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Fields missing or invalid; send the request again with them",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/connectors": {
      "get": {
        "operationId": "list-connectors",
        "summary": "List the connector catalogue",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "email",
                      "category": "Email",
                      "actions": [
                        "message.read",
                        "message.send",
                        "draft.create",
                        "label.apply"
                      ]
                    },
                    {
                      "id": "calendar",
                      "category": "Calendar",
                      "actions": [
                        "event.read",
                        "event.create",
                        "event.update",
                        "freebusy.read"
                      ]
                    },
                    {
                      "id": "crm",
                      "category": "CRM",
                      "actions": [
                        "contact.read",
                        "contact.update",
                        "deal.read",
                        "deal.update",
                        "note.create"
                      ]
                    },
                    {
                      "id": "ticketing",
                      "category": "Ticketing",
                      "actions": [
                        "ticket.read",
                        "ticket.create",
                        "ticket.update",
                        "ticket.comment"
                      ]
                    },
                    {
                      "id": "source-control",
                      "category": "Source control",
                      "actions": [
                        "repo.read",
                        "issue.create",
                        "pull_request.comment",
                        "branch.create"
                      ]
                    },
                    {
                      "id": "file-storage",
                      "category": "File storage",
                      "actions": [
                        "file.read",
                        "file.create",
                        "folder.list",
                        "share.create"
                      ]
                    },
                    {
                      "id": "chat",
                      "category": "Team chat",
                      "actions": [
                        "channel.read",
                        "message.post",
                        "message.react"
                      ]
                    },
                    {
                      "id": "wiki",
                      "category": "Docs and wiki",
                      "actions": [
                        "page.read",
                        "page.create",
                        "page.update"
                      ]
                    },
                    {
                      "id": "spreadsheet",
                      "category": "Spreadsheets",
                      "actions": [
                        "sheet.read",
                        "range.update",
                        "row.append"
                      ]
                    },
                    {
                      "id": "warehouse",
                      "category": "Data warehouse",
                      "actions": [
                        "query.run",
                        "table.list"
                      ]
                    },
                    {
                      "id": "payments",
                      "category": "Payments",
                      "actions": [
                        "invoice.read",
                        "customer.read",
                        "refund.request"
                      ]
                    },
                    {
                      "id": "hr",
                      "category": "HR system",
                      "actions": [
                        "employee.read",
                        "time_off.read"
                      ]
                    }
                  ],
                  "has_more": false
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/connectors/{connector}": {
      "get": {
        "operationId": "get-connector",
        "summary": "Get one connector",
        "parameters": [
          {
            "name": "connector",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "id": "connector",
                  "status": "available",
                  "sensitive_actions_need_approval": true
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/policies": {
      "post": {
        "operationId": "create-policy",
        "summary": "Create a permission policy",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "agent_id": {
                    "type": "string"
                  },
                  "connector": {
                    "type": "string"
                  },
                  "actions": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "agent_id",
                  "connector",
                  "actions"
                ]
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "id": "pol_0123456789abcdef",
                  "name": "name",
                  "agent_id": "agent_id",
                  "connector": "connector",
                  "status": "active",
                  "created_at": "2026-01-01T00:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/checks": {
      "post": {
        "operationId": "create-check",
        "summary": "Check whether an agent may perform an action",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent_id": {
                    "type": "string"
                  },
                  "connector": {
                    "type": "string"
                  },
                  "action": {
                    "type": "string"
                  }
                },
                "required": [
                  "agent_id",
                  "connector",
                  "action"
                ]
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "check_id": "chk_0123456789abcdef",
                  "decision": "allow",
                  "policy_id": "pol_0123456789abcdef",
                  "agent_id": "agent_id",
                  "connector": "connector",
                  "action": "action",
                  "checked_at": "2026-01-01T00:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit-events": {
      "get": {
        "operationId": "list-audit-events",
        "summary": "List audit log events for an agent",
        "parameters": [
          {
            "name": "agent_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "evt_0123456789abcdef",
                      "type": "check",
                      "agent_id": "agent_id",
                      "decision": "allow",
                      "occurred_at": "2026-01-01T00:00:00.000Z"
                    }
                  ],
                  "has_more": false
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Test key from POST /signup (wdl_test_...)"
      }
    }
  }
}
