{
  "openapi": "3.1.0",
  "info": {
    "title": "Mojo Up platform API",
    "version": "0.2.0",
    "summary": "The public HTTP API of Mojo Up AI Cloud and self-hosted AIOE.",
    "description": "The surfaces AI Workbench, its nodes, the mobile app and integrations call. Mojo Up AI Cloud and self-hosted AIOE serve the same API from the same code; operations marked \"Mojo Up AI Cloud only\" exist only on Cloud. Generated from the platform's own schemas.",
    "contact": {
      "name": "Mojo Up support",
      "url": "https://docs.mojoup.com.au/support"
    }
  },
  "servers": [
    {
      "url": "https://ai.mojoup.com.au",
      "description": "Mojo Up AI Cloud"
    },
    {
      "url": "https://{host}",
      "description": "Your self-hosted AIOE",
      "variables": {
        "host": {
          "default": "aioe.example.com.au",
          "description": "Your AIOE API's host name"
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Discovery",
      "description": "How clients find an organisation and what it offers."
    },
    {
      "name": "Organisation",
      "description": "The caller's organisation and edition."
    },
    {
      "name": "Cloud sign-in",
      "description": "Mojo Up AI Cloud's own sign-in: identity providers, emailed codes and tokens."
    },
    {
      "name": "Cloud account",
      "description": "The signed-in person on Mojo Up AI Cloud."
    },
    {
      "name": "Cloud organisations",
      "description": "Teams, members and invitations on Mojo Up AI Cloud."
    },
    {
      "name": "Devices",
      "description": "Enrolling workbenches and nodes with the device-code flow, and refreshing their tokens."
    },
    {
      "name": "Ingest",
      "description": "What workbenches report: events, usage, audit and tasks."
    },
    {
      "name": "Catalogue",
      "description": "The organisation's published templates."
    },
    {
      "name": "Policy",
      "description": "The rules a workbench enforces."
    },
    {
      "name": "Health",
      "description": "Liveness and readiness probes."
    }
  ],
  "paths": {
    "/.well-known/aioe.json": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getDiscoveryDocument",
        "summary": "Discovery document",
        "description": "Public. Tells a workbench, node or phone where to sign in and what this deployment offers. A self-hosted organisation is found from a work email: the client looks up `aioe-discover.<domain>` in DNS (a CNAME to the platform, or a TXT record `v=aioe1; url=https://…`) and then fetches this document. Mojo Up AI Cloud answers one document for everyone, with `edition: \"cloud\"`.",
        "security": [],
        "responses": {
          "200": {
            "description": "The discovery document. Cached for five minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveryDocument"
                }
              }
            }
          },
          "404": {
            "description": "Self-hosted: no organisation answers at this host name.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unknown_tenant"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/platform/v1/organisation": {
      "get": {
        "tags": [
          "Organisation"
        ],
        "operationId": "getOrganisation",
        "summary": "The caller's organisation",
        "description": "The organisation a device or person belongs to, and its edition. A workbench takes its edition from this answer: an Enterprise organisation is Enterprise, a Cloud team is Teams, a personal Cloud organisation is Free.",
        "security": [
          {
            "deviceToken": []
          },
          {
            "personToken": []
          },
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "X-Aioe-Organisation",
            "in": "header",
            "required": false,
            "description": "Mojo Up AI Cloud only, with a person's access token: the id of the organisation the request is for. A person's session is not tied to one organisation, so each request names it. Device tokens already carry their organisation.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organisation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformOrganisation"
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/auth/v1/providers": {
      "get": {
        "tags": [
          "Cloud sign-in"
        ],
        "operationId": "listSignInProviders",
        "summary": "Sign-in providers",
        "description": "Mojo Up AI Cloud only. The sign-in buttons to show: the identity providers configured on this deployment, and email.",
        "security": [],
        "responses": {
          "200": {
            "description": "The providers, in display order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInProviders"
                }
              }
            }
          }
        }
      }
    },
    "/auth/v1/start": {
      "get": {
        "tags": [
          "Cloud sign-in"
        ],
        "operationId": "startSignIn",
        "summary": "Start a sign-in with a provider",
        "description": "Mojo Up AI Cloud only. Sends the browser to the provider (Google, GitHub, Microsoft or Facebook). After the person signs in there, Cloud returns them to `redirect_uri` with a one-time `code` (valid for 60 seconds) and your `state`, or with `error`. Exchange the code at `/auth/v1/token`. Uses PKCE with S256. Redirect addresses are allow-listed per client.",
        "security": [],
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "google",
                "github",
                "microsoft",
                "facebook"
              ]
            }
          },
          {
            "name": "client",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "console",
                "mobile"
              ]
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "description": "Where to return. Must be registered for the client.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": true,
            "description": "The PKCE challenge: base64url SHA-256 of your verifier.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "S256"
              ],
              "default": "S256"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Returned to you unchanged.",
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          },
          {
            "name": "link",
            "in": "query",
            "required": false,
            "description": "A ticket from `POST /cloud/v1/me/sign-in-methods/link`, to add this provider to the signed-in person instead of signing in.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "A redirect to the provider, or back to `redirect_uri` with `error=invalid_request`."
          },
          "400": {
            "description": "`redirect_uri` is not registered, so Cloud answers here instead of redirecting.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too many sign-in requests from your network address in the last minute. Wait, then try again."
          }
        }
      }
    },
    "/auth/v1/email/start": {
      "post": {
        "tags": [
          "Cloud sign-in"
        ],
        "operationId": "startEmailSignIn",
        "summary": "Email a sign-in code",
        "description": "Mojo Up AI Cloud only. Emails a six-digit code that works for 10 minutes. Always answers 202, so it never reveals whether an address has an account. At most five codes per address per hour.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailStartInput"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted. If the address can receive mail, a code is on its way.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed or the redirect address is not registered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too many codes for this address (try again in an hour), or too many requests from your network address.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "slow_down"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/auth/v1/email/verify": {
      "post": {
        "tags": [
          "Cloud sign-in"
        ],
        "operationId": "verifyEmailCode",
        "summary": "Check an emailed code",
        "description": "Mojo Up AI Cloud only. Exchanges the six digits for a one-time code to send to `/auth/v1/token`. A code allows five tries.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailVerifyInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The one-time code, and your `state`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailVerifyResponse"
                }
              }
            }
          },
          "400": {
            "description": "The code is wrong or has expired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_code"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Adding this address to an account: it already signs in to another Mojo Up account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "already_linked"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too many sign-in requests from your network address in the last minute. Wait, then try again."
          }
        }
      }
    },
    "/auth/v1/token": {
      "post": {
        "tags": [
          "Cloud sign-in"
        ],
        "operationId": "getCloudTokens",
        "summary": "Get or refresh tokens",
        "description": "Mojo Up AI Cloud only. OAuth 2.1 shaped: exchange a one-time code (with your PKCE verifier) or a refresh token for an access token (15 minutes by default) and a refresh token (30 days by default). Refresh tokens rotate on every use; presenting an old one again ends the whole session. Accepts JSON or form-encoded bodies.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CloudTokenRequestInput"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/CloudTokenRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The token pair.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "The code or refresh token is wrong, used or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_grant"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too many sign-in requests from your network address in the last minute. Wait, then try again."
          }
        }
      }
    },
    "/auth/v1/logout": {
      "post": {
        "tags": [
          "Cloud sign-in"
        ],
        "operationId": "signOut",
        "summary": "Sign out",
        "description": "Mojo Up AI Cloud only. Ends the session the access token belongs to, with every token issued in it.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "responses": {
          "204": {
            "description": "Signed out."
          }
        }
      }
    },
    "/cloud/v1/me": {
      "get": {
        "tags": [
          "Cloud account"
        ],
        "operationId": "getMe",
        "summary": "You, your organisations and sign-in methods",
        "description": "Mojo Up AI Cloud only. Organisations are listed personal first, then teams by name.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "The signed-in person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudMe"
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Cloud account"
        ],
        "operationId": "renameMe",
        "summary": "Change your name",
        "description": "Mojo Up AI Cloud only. Your name as your teams see it, up to 100 characters.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "No name given.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Cloud account"
        ],
        "operationId": "deleteAccount",
        "summary": "Delete your account",
        "description": "Mojo Up AI Cloud only. Deletes the account, every sign-in method, and every organisation only you belong to (your personal organisation, and any team where you are the only person) with everything in them. You leave every other team, and your devices' access to it ends. Refused while you are the only owner of a team that has other people in it. Confirm with your email address (or the word `delete` if the account has no email). It cannot be undone.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAccountInput"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "The confirmation did not match.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "confirm"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "You are the only owner of these teams, which have other people in them: make someone else an owner first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "sole_owner"
                      ]
                    },
                    "organisations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/me/sign-in-methods/link": {
      "post": {
        "tags": [
          "Cloud account"
        ],
        "operationId": "getLinkTicket",
        "summary": "Start adding a sign-in method",
        "description": "Mojo Up AI Cloud only. A five-minute ticket to pass as `link` to `/auth/v1/start` or `/auth/v1/email/start`, so the new method joins your account instead of signing you in.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "The ticket.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkTicket"
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/me/sign-in-methods/{methodId}": {
      "delete": {
        "tags": [
          "Cloud account"
        ],
        "operationId": "removeSignInMethod",
        "summary": "Remove a sign-in method",
        "description": "Mojo Up AI Cloud only. You cannot remove your only way to sign in.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "methodId",
            "in": "path",
            "required": true,
            "description": "The sign-in method's id, from `GET /cloud/v1/me`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Add another way to sign in before removing this one.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "last_sign_in_method"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/organisations": {
      "post": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "createTeam",
        "summary": "Create a team",
        "description": "Mojo Up AI Cloud only. Creates a team organisation with you as its owner.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrganisationInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganisationSummary"
                }
              }
            }
          },
          "400": {
            "description": "No name given.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/organisations/{id}": {
      "patch": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "renameTeam",
        "summary": "Rename a team",
        "description": "Mojo Up AI Cloud only. Owners and admins.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameOrganisationInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Renamed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "No name given.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Only owners and admins can do this.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "forbidden"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "A personal organisation cannot be changed this way.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "personal_organisation"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/organisations/{id}/members": {
      "get": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "listMembers",
        "summary": "List members",
        "description": "Mojo Up AI Cloud only. Any member can see who else is in the organisation.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The members.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CloudMember"
                      }
                    }
                  },
                  "required": [
                    "members"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/organisations/{id}/members/{userId}": {
      "patch": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "setMemberRole",
        "summary": "Change a member's role",
        "description": "Mojo Up AI Cloud only. Owners and admins; only an owner can make or unmake an owner, and a team always keeps at least one owner.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "description": "The member's person id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetMemberRoleInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Changed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a role.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "forbidden"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Make someone else an owner first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "last_owner",
                        "personal_organisation"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "removeMember",
        "summary": "Remove a member, or leave",
        "description": "Mojo Up AI Cloud only. Owners and admins remove others; anyone can remove themselves (leave). Only an owner can remove an owner. The person's devices lose access to the organisation.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "description": "The member's person id; your own to leave.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "forbidden"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Make someone else an owner first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "last_owner",
                        "personal_organisation"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/organisations/{id}/invitations": {
      "get": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "listInvitations",
        "summary": "List open invitations",
        "description": "Mojo Up AI Cloud only. Owners and admins.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invitations not yet accepted, withdrawn or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invitations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CloudInvitation"
                      }
                    }
                  },
                  "required": [
                    "invitations"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "forbidden"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "invite",
        "summary": "Invite someone",
        "description": "Mojo Up AI Cloud only. Owners and admins. Emails a link that works once, for seven days by default. The answer carries the link too; it is shown only here.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitationInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The invitation, with its link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedInvitation"
                }
              }
            }
          },
          "400": {
            "description": "Not an email address.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "forbidden"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "A personal organisation cannot take members.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "personal_organisation"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/organisations/{id}/invitations/{invitationId}": {
      "delete": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "withdrawInvitation",
        "summary": "Withdraw an invitation",
        "description": "Mojo Up AI Cloud only. Owners and admins.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invitationId",
            "in": "path",
            "required": true,
            "description": "The invitation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Withdrawn."
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "forbidden"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found, or not yours to see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/invitations/{token}": {
      "get": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "previewInvitation",
        "summary": "See an invitation",
        "description": "Mojo Up AI Cloud only. Public: what someone opening an invitation link sees before they sign in.",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "description": "The token from the invitation link.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The invitation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationPreview"
                }
              }
            }
          },
          "404": {
            "description": "The invitation has expired or was withdrawn.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/cloud/v1/invitations/{token}/accept": {
      "post": {
        "tags": [
          "Cloud organisations"
        ],
        "operationId": "acceptInvitation",
        "summary": "Accept an invitation",
        "description": "Mojo Up AI Cloud only. Needs a sign-in method whose verified email address is the one the invitation was sent to.",
        "security": [
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "description": "The token from the invitation link.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organisation you joined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganisationSummary"
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The invitation is for another address.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "email_mismatch"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The invitation has expired or was withdrawn.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/relay/v1/device/code": {
      "post": {
        "tags": [
          "Devices"
        ],
        "operationId": "requestDeviceCode",
        "summary": "Ask to enrol a device",
        "description": "A workbench or node asks to join an organisation (RFC 8628 device authorisation). Show the person `user_code` and `verification_uri`; someone approves it in the console (a node waits for a person allowed to approve nodes). Then poll `/relay/v1/device/token`. Send `dpop_jkt` to have the tokens bound to a key (DPoP, RFC 9449).",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceCodeRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The codes, how long they last and how often to poll.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceCode"
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/relay/v1/device/token": {
      "post": {
        "tags": [
          "Devices"
        ],
        "operationId": "pollDeviceToken",
        "summary": "Poll for the device's tokens",
        "description": "Poll at the `interval` the code came with. Polling faster gets `slow_down`. With a DPoP-bound request, send a `DPoP` proof header.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceTokenRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved: the device's tokens, its id and the scopes granted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Not yet (`authorization_pending`, `slow_down`), or never (`access_denied`, `expired_token`, `invalid_grant`, `invalid_dpop_proof`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenError"
                }
              }
            }
          }
        }
      }
    },
    "/relay/v1/device/join": {
      "post": {
        "tags": [
          "Devices"
        ],
        "operationId": "joinWithKey",
        "summary": "Join a node with a join key",
        "description": "A node joins with a key an administrator created, instead of waiting for someone to approve a code. The administrator who created the key is recorded as its approver.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NodeJoinInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Joined: the node's tokens.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The key is wrong, expired or used up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_key"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/relay/v1/token": {
      "post": {
        "tags": [
          "Devices"
        ],
        "operationId": "refreshDeviceToken",
        "summary": "Refresh a device's tokens",
        "description": "Exchange a device refresh token for a new access token. DPoP-bound tokens need a `DPoP` proof header.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New tokens.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_dpop_proof"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The refresh token is wrong, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_grant"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/ingest/v1": {
      "post": {
        "tags": [
          "Ingest"
        ],
        "operationId": "ingest",
        "summary": "Send events, usage, audit and tasks",
        "description": "A workbench sends everything since its last upload in one envelope, and advances its cursors from the answer. Credentials that stray into events and audit details are redacted on receipt; a memory read is audited by label, never by content.",
        "security": [
          {
            "deviceToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformEnvelopeInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What was accepted, and the cursors now held.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResponse"
                }
              }
            }
          },
          "400": {
            "description": "The envelope does not match the schema.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_envelope"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/catalogue/v1": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "operationId": "getCatalogue",
        "summary": "The organisation's catalogue",
        "description": "The teams, roles, skills and prompts the organisation publishes, for workbenches to pull into their templates. Tool servers (`mcp`) and document templates are served only to a caller that asks for them with `include`. Supports `If-None-Match`.",
        "security": [
          {
            "deviceToken": []
          },
          {
            "personToken": []
          },
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "X-Aioe-Organisation",
            "in": "header",
            "required": false,
            "description": "Mojo Up AI Cloud only, with a person's access token: the id of the organisation the request is for. A person's session is not tied to one organisation, so each request names it. Device tokens already carry their organisation.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Comma-separated extra kinds: `mcp` adds tool servers; any value adds document templates.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The catalogue.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalogue"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged since the ETag you sent."
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/policy/v1": {
      "get": {
        "tags": [
          "Policy"
        ],
        "operationId": "getPolicy",
        "summary": "The policy that applies",
        "description": "The organisation's effective policy for a workbench, or for one project when `projectId` is given: runtimes, providers, data loss prevention, approvals, remote control, network, tools, governed settings and more.",
        "security": [
          {
            "deviceToken": []
          },
          {
            "personToken": []
          },
          {
            "cloudSession": []
          }
        ],
        "parameters": [
          {
            "name": "X-Aioe-Organisation",
            "in": "header",
            "required": false,
            "description": "Mojo Up AI Cloud only, with a person's access token: the id of the organisation the request is for. A person's session is not tied to one organisation, so each request names it. Device tokens already carry their organisation.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "description": "The organisation project to resolve the policy for.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The effective policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyResponse"
                }
              }
            }
          },
          "401": {
            "description": "No valid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "tags": [
          "Health"
        ],
        "operationId": "health",
        "summary": "Liveness",
        "description": "Public. Answers while the process is up, with its version.",
        "security": [],
        "responses": {
          "200": {
            "description": "Up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/readyz": {
      "get": {
        "tags": [
          "Health"
        ],
        "operationId": "ready",
        "summary": "Readiness",
        "description": "Public. Answers when the API is ready for traffic.",
        "security": [],
        "responses": {
          "200": {
            "description": "Ready.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Catalogue": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1
          },
          "publishedAt": {
            "type": "string"
          },
          "entries": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "team",
                    "role",
                    "skill",
                    "prompt",
                    "mcp",
                    "document"
                  ]
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "summary": {
                  "type": "string",
                  "maxLength": 2000
                },
                "version": {
                  "type": "string",
                  "maxLength": 40
                },
                "content": {},
                "files": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "kind",
                "name",
                "content"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "version",
          "entries"
        ],
        "additionalProperties": false
      },
      "CloudInvitation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "invitedBy": {
            "type": "string"
          },
          "invitedByName": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "invitedBy",
          "createdAt",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "CloudMe": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "organisations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "personal",
                    "team"
                  ]
                },
                "plan": {
                  "type": "string",
                  "enum": [
                    "free",
                    "teams"
                  ]
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "owner",
                    "admin",
                    "member"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "kind",
                "plan",
                "role"
              ],
              "additionalProperties": false
            }
          },
          "signInMethods": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "provider": {
                  "type": "string",
                  "enum": [
                    "google",
                    "github",
                    "microsoft",
                    "facebook",
                    "email"
                  ]
                },
                "email": {
                  "type": "string"
                },
                "emailVerified": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string"
                },
                "lastUsedAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "provider",
                "emailVerified",
                "createdAt",
                "lastUsedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "organisations",
          "signInMethods"
        ],
        "additionalProperties": false
      },
      "CloudMember": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "joinedAt": {
            "type": "string"
          }
        },
        "required": [
          "userId",
          "role",
          "joinedAt"
        ],
        "additionalProperties": false
      },
      "CloudTokenRequestInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "grant_type": {
                "type": "string",
                "const": "authorization_code"
              },
              "code": {
                "type": "string",
                "minLength": 1
              },
              "code_verifier": {
                "type": "string",
                "minLength": 43,
                "maxLength": 128
              },
              "redirect_uri": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "grant_type",
              "code",
              "code_verifier",
              "redirect_uri"
            ]
          },
          {
            "type": "object",
            "properties": {
              "grant_type": {
                "type": "string",
                "const": "refresh_token"
              },
              "refresh_token": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "grant_type",
              "refresh_token"
            ]
          }
        ]
      },
      "CloudTokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "expires_in": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "token_type": {
            "type": "string",
            "const": "Bearer"
          }
        },
        "required": [
          "access_token",
          "refresh_token",
          "expires_in",
          "token_type"
        ],
        "additionalProperties": false
      },
      "CreatedInvitation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "invitedBy": {
            "type": "string"
          },
          "invitedByName": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "link": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "invitedBy",
          "createdAt",
          "expiresAt",
          "link"
        ],
        "additionalProperties": false
      },
      "CreateInvitationInput": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "role": {
            "default": "member",
            "type": "string",
            "enum": [
              "admin",
              "member"
            ]
          }
        },
        "required": [
          "email"
        ]
      },
      "CreateOrganisationInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "required": [
          "name"
        ]
      },
      "DeleteAccountInput": {
        "type": "object",
        "properties": {
          "confirm": {
            "type": "string",
            "minLength": 1,
            "maxLength": 254
          }
        },
        "required": [
          "confirm"
        ]
      },
      "DeviceCode": {
        "type": "object",
        "properties": {
          "device_code": {
            "type": "string"
          },
          "user_code": {
            "type": "string"
          },
          "verification_uri": {
            "type": "string",
            "format": "uri"
          },
          "verification_uri_complete": {
            "type": "string",
            "format": "uri"
          },
          "interval": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "expires_in": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "device_code",
          "user_code",
          "verification_uri"
        ],
        "additionalProperties": false
      },
      "DeviceCodeRequestInput": {
        "type": "object",
        "properties": {
          "workspaceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "deviceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "kind": {
            "type": "string",
            "enum": [
              "desktop",
              "node"
            ]
          },
          "tags": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "manifest": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 1
              },
              "nodeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "kind": {
                "type": "string",
                "const": "node"
              },
              "roles": {
                "default": [
                  "teams"
                ],
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "teams",
                    "inference",
                    "dlp",
                    "sandbox",
                    "computer"
                  ]
                }
              },
              "owner": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "user",
                      "org",
                      "project"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "tags": {
                    "default": [],
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  }
                },
                "required": [
                  "type"
                ]
              },
              "runtimes": {
                "default": [],
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "version": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "authenticated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id"
                  ]
                }
              },
              "models": {
                "default": [],
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "contextLength": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 10000000
                    },
                    "acceleration": {
                      "type": "string",
                      "enum": [
                        "cpu",
                        "gpu"
                      ]
                    },
                    "service": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "required": [
                    "id"
                  ]
                }
              },
              "memory": {
                "default": [],
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "obsidian",
                        "graphify"
                      ]
                    },
                    "scopes": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "repo",
                          "knowledge"
                        ]
                      }
                    },
                    "root": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "scopes"
                  ]
                }
              },
              "repos": {
                "default": [],
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "rootId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "remote": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "branch": {
                      "type": "string",
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "rootId"
                  ]
                }
              },
              "resources": {
                "default": {},
                "type": "object",
                "properties": {
                  "cpu": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 100000
                  },
                  "ramGb": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "gpus": {
                    "default": [],
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "vramGb": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100000
                        }
                      },
                      "required": [
                        "name"
                      ]
                    }
                  }
                }
              },
              "services": {
                "default": {},
                "type": "object",
                "properties": {
                  "control": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "model": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "memory": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "dlp": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "sandbox": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "computer": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  }
                }
              },
              "policy": {
                "default": {},
                "type": "object",
                "properties": {
                  "acceptsDispatchFrom": {
                    "default": [],
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "maxConcurrentAgents": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  }
                }
              },
              "sandbox": {
                "type": "object",
                "properties": {
                  "engine": {
                    "type": "string",
                    "enum": [
                      "docker",
                      "podman"
                    ]
                  },
                  "images": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300
                    }
                  },
                  "maxConcurrent": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  },
                  "egress": {
                    "type": "string",
                    "enum": [
                      "policy",
                      "none"
                    ]
                  }
                },
                "required": [
                  "engine",
                  "images"
                ]
              },
              "computer": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "browser",
                      "desktop"
                    ]
                  },
                  "display": {
                    "type": "string",
                    "enum": [
                      "headless",
                      "xvfb",
                      "vnc",
                      "native"
                    ]
                  },
                  "sessions": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  }
                },
                "required": [
                  "kind"
                ]
              },
              "home": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              "sandboxCheck": {
                "type": "object",
                "properties": {
                  "canSandbox": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "kernel": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "landlockAbi": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "openshell": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "docker": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "canSandbox",
                  "kernel"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "nodeId",
              "name",
              "kind",
              "owner"
            ]
          },
          "dpop_jkt": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          }
        },
        "required": [
          "workspaceId",
          "name"
        ]
      },
      "DeviceTokenRequestInput": {
        "type": "object",
        "properties": {
          "device_code": {
            "type": "string"
          }
        },
        "required": [
          "device_code"
        ]
      },
      "DiscoveryDocument": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1
          },
          "tenant": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "organisation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "apiUrl": {
            "type": "string",
            "format": "uri"
          },
          "relayUrl": {
            "type": "string",
            "format": "uri"
          },
          "meshUrl": {
            "type": "string",
            "format": "uri"
          },
          "signingKeysUrl": {
            "type": "string",
            "format": "uri"
          },
          "auth": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "oidc"
              },
              "issuer": {
                "type": "string",
                "format": "uri"
              },
              "clientId": {
                "type": "string",
                "minLength": 1
              },
              "apiScope": {
                "type": "string",
                "minLength": 1
              },
              "deviceAuthorizationEndpoint": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "kind",
              "issuer",
              "clientId",
              "apiScope"
            ],
            "additionalProperties": false
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ingest",
                "catalogue",
                "policy",
                "relay",
                "mesh",
                "remote-control"
              ]
            }
          },
          "dpopSigningAlgs": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ES256",
                "EdDSA"
              ]
            }
          },
          "edition": {
            "type": "string",
            "enum": [
              "enterprise",
              "cloud"
            ]
          },
          "releasesUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "version",
          "tenant",
          "organisation",
          "apiUrl",
          "relayUrl",
          "auth",
          "capabilities"
        ],
        "additionalProperties": false
      },
      "EmailStartInput": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "client": {
            "type": "string",
            "enum": [
              "console",
              "mobile"
            ]
          },
          "redirect_uri": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "code_challenge": {
            "type": "string",
            "minLength": 43,
            "maxLength": 128
          },
          "code_challenge_method": {
            "default": "S256",
            "type": "string",
            "const": "S256"
          },
          "state": {
            "type": "string",
            "maxLength": 500
          },
          "link": {
            "type": "string",
            "maxLength": 300
          }
        },
        "required": [
          "email",
          "client",
          "redirect_uri",
          "code_challenge"
        ]
      },
      "EmailVerifyInput": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "code": {
            "type": "string",
            "pattern": "^\\d{6}$"
          },
          "state": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "email",
          "code"
        ]
      },
      "EmailVerifyResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "code"
        ],
        "additionalProperties": false
      },
      "IngestResponse": {
        "type": "object",
        "properties": {
          "accepted": {
            "type": "object",
            "properties": {
              "events": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "usage": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "audit": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "tasks": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "events",
              "usage",
              "audit",
              "tasks"
            ],
            "additionalProperties": false
          },
          "cursors": {
            "type": "object",
            "properties": {
              "events": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "usage": {
                "type": "string"
              },
              "audit": {
                "type": "string"
              }
            },
            "required": [
              "events"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "accepted",
          "cursors"
        ],
        "additionalProperties": false
      },
      "InvitationPreview": {
        "type": "object",
        "properties": {
          "organisation": {
            "type": "string"
          },
          "invitedBy": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          },
          "expiresAt": {
            "type": "string"
          }
        },
        "required": [
          "organisation",
          "email",
          "role",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "LinkTicket": {
        "type": "object",
        "properties": {
          "ticket": {
            "type": "string"
          },
          "expiresIn": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "ticket",
          "expiresIn"
        ],
        "additionalProperties": false
      },
      "NodeJoinInput": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 10,
            "maxLength": 200
          },
          "manifest": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 1
              },
              "nodeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "kind": {
                "type": "string",
                "const": "node"
              },
              "roles": {
                "default": [
                  "teams"
                ],
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "teams",
                    "inference",
                    "dlp",
                    "sandbox",
                    "computer"
                  ]
                }
              },
              "owner": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "user",
                      "org",
                      "project"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "tags": {
                    "default": [],
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  }
                },
                "required": [
                  "type"
                ]
              },
              "runtimes": {
                "default": [],
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "version": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "authenticated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id"
                  ]
                }
              },
              "models": {
                "default": [],
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "contextLength": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 10000000
                    },
                    "acceleration": {
                      "type": "string",
                      "enum": [
                        "cpu",
                        "gpu"
                      ]
                    },
                    "service": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "required": [
                    "id"
                  ]
                }
              },
              "memory": {
                "default": [],
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "obsidian",
                        "graphify"
                      ]
                    },
                    "scopes": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "repo",
                          "knowledge"
                        ]
                      }
                    },
                    "root": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "scopes"
                  ]
                }
              },
              "repos": {
                "default": [],
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "rootId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "remote": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "branch": {
                      "type": "string",
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "rootId"
                  ]
                }
              },
              "resources": {
                "default": {},
                "type": "object",
                "properties": {
                  "cpu": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 100000
                  },
                  "ramGb": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "gpus": {
                    "default": [],
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "vramGb": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100000
                        }
                      },
                      "required": [
                        "name"
                      ]
                    }
                  }
                }
              },
              "services": {
                "default": {},
                "type": "object",
                "properties": {
                  "control": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "model": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "memory": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "dlp": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "sandbox": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "computer": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  }
                }
              },
              "policy": {
                "default": {},
                "type": "object",
                "properties": {
                  "acceptsDispatchFrom": {
                    "default": [],
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "maxConcurrentAgents": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  }
                }
              },
              "sandbox": {
                "type": "object",
                "properties": {
                  "engine": {
                    "type": "string",
                    "enum": [
                      "docker",
                      "podman"
                    ]
                  },
                  "images": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300
                    }
                  },
                  "maxConcurrent": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  },
                  "egress": {
                    "type": "string",
                    "enum": [
                      "policy",
                      "none"
                    ]
                  }
                },
                "required": [
                  "engine",
                  "images"
                ]
              },
              "computer": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "browser",
                      "desktop"
                    ]
                  },
                  "display": {
                    "type": "string",
                    "enum": [
                      "headless",
                      "xvfb",
                      "vnc",
                      "native"
                    ]
                  },
                  "sessions": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  }
                },
                "required": [
                  "kind"
                ]
              },
              "home": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              "sandboxCheck": {
                "type": "object",
                "properties": {
                  "canSandbox": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "kernel": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "landlockAbi": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "openshell": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "docker": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "canSandbox",
                  "kernel"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "nodeId",
              "name",
              "kind",
              "owner"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "tags": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        },
        "required": [
          "key",
          "manifest",
          "name"
        ]
      },
      "OrganisationSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "personal",
              "team"
            ]
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "teams"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "plan",
          "role"
        ],
        "additionalProperties": false
      },
      "PlatformEnvelopeInput": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 1
          },
          "projectId": {
            "type": "string"
          },
          "workspaceId": {
            "type": "string"
          },
          "sentAt": {
            "type": "string"
          },
          "cursors": {
            "type": "object",
            "properties": {
              "events": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "usage": {
                "type": "string"
              },
              "audit": {
                "type": "string"
              }
            },
            "required": [
              "events"
            ]
          },
          "events": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "seq": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "at": {
                  "type": "number"
                },
                "kind": {
                  "type": "string"
                },
                "payload": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "seq",
                "at",
                "kind",
                "payload"
              ]
            }
          },
          "usage": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "agentKey": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "promptTokens": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "completionTokens": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "exactUsage": {
                  "type": "boolean"
                },
                "costUsd": {
                  "type": "number",
                  "minimum": 0
                },
                "latencyMs": {
                  "type": "number",
                  "minimum": 0
                },
                "toolCalls": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ok",
                    "error",
                    "cancelled"
                  ]
                },
                "repairs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "principal": {
                  "type": "string",
                  "maxLength": 200
                },
                "actor": {
                  "type": "string",
                  "maxLength": 200
                },
                "rootId": {
                  "type": "string",
                  "maxLength": 200
                },
                "teamId": {
                  "type": "string",
                  "maxLength": 200
                },
                "taskId": {
                  "type": "string",
                  "maxLength": 100
                }
              },
              "required": [
                "at",
                "provider",
                "model",
                "promptTokens",
                "completionTokens",
                "exactUsage",
                "latencyMs",
                "toolCalls",
                "status"
              ]
            }
          },
          "audit": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ts": {
                  "type": "string"
                },
                "actor": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "user",
                        "remote",
                        "agent",
                        "system",
                        "schedule"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "teamId": {
                      "type": "string"
                    },
                    "agentName": {
                      "type": "string"
                    },
                    "taskId": {
                      "type": "string"
                    },
                    "principal": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind"
                  ]
                },
                "action": {
                  "type": "string"
                },
                "target": {
                  "type": "string"
                },
                "teamId": {
                  "type": "string"
                },
                "sessionId": {
                  "type": "string"
                },
                "taskId": {
                  "type": "string"
                },
                "detail": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "outcome": {
                  "type": "string",
                  "enum": [
                    "ok",
                    "denied",
                    "error"
                  ]
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "ts",
                "actor",
                "action",
                "outcome"
              ]
            }
          },
          "tasks": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "uid": {
                  "type": "string"
                },
                "teamId": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "priority": {
                  "type": "string"
                },
                "assignee": {
                  "type": "string"
                },
                "labels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                },
                "outcome": {
                  "type": "string"
                },
                "principal": {
                  "type": "string",
                  "maxLength": 200
                },
                "actor": {
                  "type": "string",
                  "maxLength": 200
                }
              },
              "required": [
                "id",
                "teamId",
                "title",
                "status",
                "priority",
                "labels",
                "createdAt",
                "updatedAt"
              ]
            }
          }
        },
        "required": [
          "schemaVersion",
          "projectId",
          "workspaceId",
          "sentAt",
          "cursors"
        ]
      },
      "PlatformOrganisation": {
        "type": "object",
        "properties": {
          "edition": {
            "type": "string",
            "enum": [
              "enterprise",
              "cloud"
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "enterprise",
              "personal",
              "team"
            ]
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "teams"
            ]
          }
        },
        "required": [
          "edition",
          "id",
          "name",
          "kind"
        ],
        "additionalProperties": false
      },
      "PolicyResponse": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "string"
          },
          "policy": {
            "type": "object",
            "properties": {
              "version": {
                "default": 1,
                "type": "number",
                "const": 1
              },
              "source": {
                "type": "string"
              },
              "allowedRuntimes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "allowedProviders": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "inference": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "dlp": {
                "type": "object",
                "properties": {
                  "classify": {
                    "default": false,
                    "type": "boolean"
                  },
                  "classifier": {
                    "type": "object",
                    "properties": {
                      "provider": {
                        "default": "ollama",
                        "type": "string"
                      },
                      "model": {
                        "type": "string"
                      },
                      "endpoint": {
                        "type": "string"
                      },
                      "node": {
                        "type": "string"
                      },
                      "tags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "provider"
                    ],
                    "additionalProperties": false
                  },
                  "onSecrets": {
                    "default": "redact",
                    "type": "string",
                    "enum": [
                      "allow",
                      "redact",
                      "block",
                      "ask"
                    ]
                  },
                  "onPii": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "redact",
                      "block",
                      "ask"
                    ]
                  },
                  "onPromptInjection": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "block",
                      "ask"
                    ]
                  },
                  "blockSensitivity": {
                    "default": [
                      "restricted"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "public",
                        "internal",
                        "confidential",
                        "restricted"
                      ]
                    }
                  },
                  "onUnclassified": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "ask",
                      "block"
                    ]
                  },
                  "latencyBudgetMs": {
                    "default": 300,
                    "type": "integer",
                    "minimum": 50,
                    "maximum": 5000
                  }
                },
                "required": [
                  "classify",
                  "classifier",
                  "onSecrets",
                  "onPii",
                  "onPromptInjection",
                  "blockSensitivity",
                  "onUnclassified",
                  "latencyBudgetMs"
                ],
                "additionalProperties": false
              },
              "approvals": {
                "type": "object",
                "properties": {
                  "remoteApprovals": {
                    "type": "object",
                    "properties": {
                      "low": {
                        "default": "allow",
                        "type": "string",
                        "enum": [
                          "allow",
                          "deny"
                        ]
                      },
                      "medium": {
                        "default": "allow",
                        "type": "string",
                        "enum": [
                          "allow",
                          "deny"
                        ]
                      },
                      "high": {
                        "default": "deny",
                        "type": "string",
                        "enum": [
                          "allow",
                          "deny"
                        ]
                      }
                    },
                    "required": [
                      "low",
                      "medium",
                      "high"
                    ],
                    "additionalProperties": false
                  },
                  "requireHumanReviewLabels": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "decisionApproval": {
                    "type": "string",
                    "enum": [
                      "none",
                      "wider",
                      "all"
                    ]
                  }
                },
                "required": [
                  "remoteApprovals",
                  "requireHumanReviewLabels"
                ],
                "additionalProperties": false
              },
              "remote": {
                "type": "object",
                "properties": {
                  "allowTransports": {
                    "default": [
                      "ipc",
                      "lan",
                      "relay"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "ipc",
                        "companion",
                        "lan",
                        "relay"
                      ]
                    }
                  },
                  "maxScopes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "idleTimeoutMinutes": {
                    "default": 60,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1440
                  },
                  "requireTls": {
                    "type": "boolean"
                  },
                  "killSwitchLockedOn": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "allowTransports",
                  "idleTimeoutMinutes"
                ],
                "additionalProperties": false
              },
              "git": {
                "type": "object",
                "properties": {
                  "protectedBranches": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "requirePullRequest": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "protectedBranches",
                  "requirePullRequest"
                ],
                "additionalProperties": false
              },
              "agents": {
                "type": "object",
                "properties": {
                  "sandbox": {
                    "default": "off",
                    "type": "string",
                    "enum": [
                      "off",
                      "preferred",
                      "required"
                    ]
                  }
                },
                "required": [
                  "sandbox"
                ],
                "additionalProperties": false
              },
              "network": {
                "type": "object",
                "properties": {
                  "allowHosts": {
                    "default": [],
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 253
                    }
                  },
                  "denyHosts": {
                    "default": [],
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 253
                    }
                  },
                  "defaultAction": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "deny"
                    ]
                  },
                  "enforcement": {
                    "default": "enforce",
                    "type": "string",
                    "enum": [
                      "audit",
                      "enforce"
                    ]
                  },
                  "rules": {
                    "default": [],
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "endpoints": {
                          "minItems": 1,
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "host": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 253
                              },
                              "ports": {
                                "maxItems": 50,
                                "type": "array",
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 65535
                                }
                              },
                              "protocol": {
                                "default": "tcp",
                                "type": "string",
                                "enum": [
                                  "tcp",
                                  "rest",
                                  "websocket",
                                  "graphql",
                                  "mcp",
                                  "json-rpc"
                                ]
                              },
                              "allow": {
                                "maxItems": 100,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "method": {
                                      "type": "string",
                                      "maxLength": 10
                                    },
                                    "path": {
                                      "type": "string",
                                      "maxLength": 500
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              "deny": {
                                "maxItems": 100,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "method": {
                                      "type": "string",
                                      "maxLength": 10
                                    },
                                    "path": {
                                      "type": "string",
                                      "maxLength": 500
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              },
                              "tools": {
                                "type": "object",
                                "properties": {
                                  "allow": {
                                    "maxItems": 500,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "maxLength": 200
                                    }
                                  },
                                  "deny": {
                                    "maxItems": 500,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "maxLength": 200
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "host",
                              "protocol"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "programs": {
                          "default": [],
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          }
                        },
                        "enforcement": {
                          "type": "string",
                          "enum": [
                            "audit",
                            "enforce"
                          ]
                        }
                      },
                      "required": [
                        "name",
                        "endpoints",
                        "programs"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "allowHosts",
                  "denyHosts",
                  "defaultAction",
                  "enforcement",
                  "rules"
                ],
                "additionalProperties": false
              },
              "tools": {
                "type": "object",
                "properties": {
                  "enforcement": {
                    "default": "audit",
                    "type": "string",
                    "enum": [
                      "audit",
                      "enforce"
                    ]
                  },
                  "unlistedServers": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "ask",
                      "block"
                    ]
                  },
                  "defaults": {
                    "type": "object",
                    "properties": {
                      "reads": {
                        "default": "allow",
                        "type": "string",
                        "enum": [
                          "allow",
                          "ask",
                          "off"
                        ]
                      },
                      "changes": {
                        "default": "ask",
                        "type": "string",
                        "enum": [
                          "allow",
                          "ask",
                          "off"
                        ]
                      },
                      "destroys": {
                        "default": "off",
                        "type": "string",
                        "enum": [
                          "allow",
                          "ask",
                          "off"
                        ]
                      }
                    },
                    "required": [
                      "reads",
                      "changes",
                      "destroys"
                    ],
                    "additionalProperties": false
                  },
                  "rules": {
                    "default": [],
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "server": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "tools": {
                          "maxItems": 200,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "risk": {
                          "type": "string",
                          "enum": [
                            "reads",
                            "changes",
                            "destroys"
                          ]
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "allow",
                            "ask",
                            "off"
                          ]
                        },
                        "roles": {
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          }
                        }
                      },
                      "required": [
                        "server",
                        "action"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "recordArguments": {
                    "default": "redacted",
                    "type": "string",
                    "enum": [
                      "none",
                      "redacted"
                    ]
                  },
                  "servers": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "fingerprint": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "published",
                            "withdrawn"
                          ]
                        },
                        "tools": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "risk": {
                                "type": "string",
                                "enum": [
                                  "reads",
                                  "changes",
                                  "destroys"
                                ]
                              },
                              "action": {
                                "type": "string",
                                "enum": [
                                  "allow",
                                  "ask",
                                  "off"
                                ]
                              },
                              "hash": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "description": {
                                "type": "string",
                                "maxLength": 4000
                              }
                            },
                            "required": [
                              "risk"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "fingerprint",
                        "status",
                        "tools"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "enforcement",
                  "unlistedServers",
                  "defaults",
                  "rules",
                  "recordArguments"
                ],
                "additionalProperties": false
              },
              "secrets": {
                "type": "object",
                "properties": {
                  "agentEnvironment": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "deny"
                    ]
                  },
                  "machineEnvironment": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "deny"
                    ]
                  },
                  "personalSecrets": {
                    "default": "allow",
                    "type": "string",
                    "enum": [
                      "allow",
                      "deny"
                    ]
                  }
                },
                "required": [
                  "agentEnvironment",
                  "machineEnvironment",
                  "personalSecrets"
                ],
                "additionalProperties": false
              },
              "teams": {
                "type": "object",
                "properties": {
                  "allowGranted": {
                    "default": true,
                    "type": "boolean"
                  },
                  "allowPersonal": {
                    "default": true,
                    "type": "boolean"
                  },
                  "granted": {
                    "default": [],
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    }
                  }
                },
                "required": [
                  "allowGranted",
                  "allowPersonal",
                  "granted"
                ],
                "additionalProperties": false
              },
              "pullRequests": {
                "type": "object",
                "properties": {
                  "requiredApprovals": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10
                  },
                  "allowSelfMerge": {
                    "default": false,
                    "type": "boolean"
                  },
                  "mergeMethods": {
                    "default": [
                      "merge",
                      "squash",
                      "rebase"
                    ],
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "merge",
                        "squash",
                        "rebase"
                      ]
                    }
                  },
                  "requireChecks": {
                    "default": true,
                    "type": "boolean"
                  },
                  "agentsMayMerge": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "requiredApprovals",
                  "allowSelfMerge",
                  "mergeMethods",
                  "requireChecks",
                  "agentsMayMerge"
                ],
                "additionalProperties": false
              },
              "settings": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "settingsMode": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string",
                  "enum": [
                    "locked",
                    "default"
                  ]
                }
              }
            },
            "required": [
              "version",
              "dlp",
              "approvals",
              "remote",
              "git"
            ],
            "additionalProperties": false
          },
          "published": {
            "type": "boolean"
          }
        },
        "required": [
          "revision",
          "policy"
        ],
        "additionalProperties": false
      },
      "RefreshRequestInput": {
        "type": "object",
        "properties": {
          "refresh_token": {
            "type": "string"
          }
        },
        "required": [
          "refresh_token"
        ]
      },
      "RenameOrganisationInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "required": [
          "name"
        ]
      },
      "SetMemberRoleInput": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "member"
            ]
          }
        },
        "required": [
          "role"
        ]
      },
      "SignInProviders": {
        "type": "object",
        "properties": {
          "providers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "google",
                    "github",
                    "microsoft",
                    "facebook",
                    "email"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "providers"
        ],
        "additionalProperties": false
      },
      "TokenError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "authorization_pending",
              "slow_down",
              "expired_token",
              "access_denied",
              "invalid_grant",
              "invalid_dpop_proof"
            ]
          },
          "error_description": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "TokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "expires_in": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "token_type": {
            "type": "string",
            "enum": [
              "Bearer",
              "DPoP"
            ]
          },
          "device_id": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "access_token",
          "expires_in"
        ],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "deviceToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "A device access token from the device-code flow (`aioe_at_…`). A DPoP-bound token is sent as `Authorization: DPoP <token>` with a fresh `DPoP` proof on every request."
      },
      "personToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Self-hosted AIOE: an access token from your organisation's identity provider. Its issuer selects the organisation."
      },
      "cloudSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "Mojo Up AI Cloud: a person's access token from `/auth/v1/token`. Name the organisation with the `X-Aioe-Organisation` header where a request acts for one."
      }
    }
  }
}
