{
    "openapi": "3.1.0",
    "info": {
        "title": "Clauth API",
        "version": "dev",
        "description": "Manage people, organizations, access profiles and apps. Authenticate with an API client (Organization \u203a API clients: client credentials at /oauth/token, then Bearer) or a personal API token (My account \u203a API tokens). Errors are RFC 9457 problem+json. POST accepts Idempotency-Key. Single resources send an ETag; PATCH/PUT/DELETE honour If-Match (412 when it changed).",
        "license": {
            "name": "MIT"
        }
    },
    "servers": [
        {
            "url": "https://app.helloclauth.com/api/v1"
        }
    ],
    "paths": {
        "/agents/{agent}": {
            "get": {
                "summary": "One agent ({agent} = agt_ id)",
                "tags": [
                    "Agents"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "agents:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Rename, or suspend / resume (status)",
                "tags": [
                    "Agents"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "agents:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    },
                                    "status": {
                                        "description": "active|suspended"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete the agent and revoke its tokens",
                "tags": [
                    "Agents"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "agents:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/agents/{agent}/access": {
            "put": {
                "summary": "An organization agent\u2019s role per app (null = none)",
                "tags": [
                    "Agents"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "agents:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "apps": {
                                        "description": "{app_key: role_key|null}"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/agents/{agent}/secret": {
            "post": {
                "summary": "New credentials (the old ones stop working)",
                "tags": [
                    "Agents"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "agents:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps": {
            "get": {
                "summary": "Apps published by or installed in this client's organization",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Register an app (+ its first client; the secret is in this response only)",
                "tags": [
                    "Apps"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "key": {
                                        "description": "string"
                                    },
                                    "type": {
                                        "description": "web|public|m2m"
                                    },
                                    "redirect_uri": {
                                        "description": "url"
                                    },
                                    "home_url": {
                                        "description": "url"
                                    },
                                    "publisher": {
                                        "description": "org slug (personal/platform tokens)"
                                    },
                                    "orgs": {
                                        "description": "org slugs to install in"
                                    },
                                    "privacy_url": {
                                        "description": "url"
                                    },
                                    "terms_url": {
                                        "description": "url"
                                    },
                                    "support_email": {
                                        "description": "email"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}": {
            "get": {
                "summary": "One app with roles, permissions and (publisher only) clients",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change app settings (If-Match supported)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "home_url": {
                                        "description": "url"
                                    },
                                    "manifest_url": {
                                        "description": "url"
                                    },
                                    "status": {
                                        "description": "live|paused|not_connected"
                                    },
                                    "color": {
                                        "description": "#rrggbb"
                                    },
                                    "visibility": {
                                        "description": "private|installable"
                                    },
                                    "require_mfa_roles": {
                                        "description": "role keys"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete the app (owners/admins of the publisher; send confirm = app key)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "confirm": {
                                        "description": "the app key"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/authorization-detail-types": {
            "get": {
                "summary": "Types the app accepts in authorization_details (RFC 9396)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/authorization-detail-types/{type}": {
            "put": {
                "summary": "Register a type with its JSON Schema and optional processor (your server confirms or fills in)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "type",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "description": {
                                        "description": "shown to the person"
                                    },
                                    "schema": {
                                        "description": "JSON Schema (object)"
                                    },
                                    "processor_url": {
                                        "description": "https URL"
                                    },
                                    "processor_secret": {
                                        "description": "HMAC secret"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove a type",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "type",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/branding": {
            "put": {
                "summary": "Sign-in page look (JSON or multipart with logo files)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "login_theme": {
                                        "description": "classic|daylight|midnight|auto"
                                    },
                                    "theme": {
                                        "description": "designed theme key (instead of login_theme)"
                                    },
                                    "accent_color": {
                                        "description": "#rrggbb"
                                    },
                                    "logo": {
                                        "description": "png/svg file"
                                    },
                                    "logo_dark": {
                                        "description": "png/svg file"
                                    },
                                    "remove_logo": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "Same as PUT (for multipart uploads from tools that only POST)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/clients": {
            "post": {
                "summary": "Add a client (secret shown once), or one described by a client ID metadata document (cimd_url)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "description": "web|public|m2m|device"
                                    },
                                    "name": {
                                        "description": "string"
                                    },
                                    "redirect_uri": {
                                        "description": "url"
                                    },
                                    "cimd_url": {
                                        "description": "https URL of a client metadata document"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/clients/{client}": {
            "patch": {
                "summary": "Change a client's name or redirect URLs",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "redirect_uris": {
                                        "description": "urls"
                                    },
                                    "post_logout_redirect_uris": {
                                        "description": "urls"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/clients/{client}/revoke": {
            "post": {
                "summary": "Turn a client off and revoke its tokens",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/clients/{client}/rotate": {
            "post": {
                "summary": "New client secret (shown once)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/deliveries/{delivery}/redeliver": {
            "post": {
                "summary": "Send a delivery again",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "delivery",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/domain": {
            "get": {
                "summary": "The app's sign-in domain, status and DNS records",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Add a sign-in domain (or share one the publisher verified)",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "host": {
                                        "description": "auth.example.com"
                                    },
                                    "share": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Display name, theme (trusted: Clauth owners)",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "display_name": {
                                        "description": "string"
                                    },
                                    "theme": {
                                        "description": "designed theme key or null"
                                    },
                                    "trusted": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Stop using the domain (last app out deletes it)",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/domain/check": {
            "post": {
                "summary": "Check DNS and certificate now",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/installations": {
            "get": {
                "summary": "Organizations the app is installed in or requested by",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Install in an organization you run, or request it elsewhere",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "org": {
                                        "description": "slug"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/installations/{org}": {
            "delete": {
                "summary": "Remove from an organization (its access there goes)",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/manifest/sync": {
            "post": {
                "summary": "Fetch /.well-known/clauth.json and apply it",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/people": {
            "get": {
                "summary": "Everyone with access to the app, with the orgs claim their token carries (?since= for changes). The app\u2019s own server client (users:read) or an API client",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": []
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/permissions": {
            "post": {
                "summary": "Add a permission by hand",
                "tags": [
                    "Roles"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/policy": {
            "get": {
                "summary": "Sign-in rules of an app: rules in force, where they come from, version",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "put": {
                "summary": "Replace the rules (new version)",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "password": {
                                        "description": "bool"
                                    },
                                    "google": {
                                        "description": "bool"
                                    },
                                    "connections": {
                                        "description": "\"all\" or keys"
                                    },
                                    "email_code": {
                                        "description": "bool"
                                    },
                                    "sms_code": {
                                        "description": "bool"
                                    },
                                    "two_step": {
                                        "description": "default|always"
                                    },
                                    "sms_second_step": {
                                        "description": "bool"
                                    },
                                    "registration": {
                                        "description": "invite|open (apps)"
                                    },
                                    "open_domains": {
                                        "description": "domains"
                                    },
                                    "open_profile": {
                                        "description": "profile key"
                                    },
                                    "check": {
                                        "description": "http connection key"
                                    },
                                    "check_fail_open": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove these rules so the next level applies",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/policy/restore": {
            "post": {
                "summary": "Restore a saved version (as a new version)",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "version": {
                                        "description": "int"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/policy/versions": {
            "get": {
                "summary": "Saved versions of these rules",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/registration-tokens": {
            "post": {
                "summary": "Initial access token for dynamic client registration (RFC 7591) at /oauth/register into this app; shown once",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "uses": {
                                        "description": "int"
                                    },
                                    "days": {
                                        "description": "int (default 30)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/roles": {
            "post": {
                "summary": "Add a role",
                "tags": [
                    "Roles"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "description": "string"
                                    },
                                    "name": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    },
                                    "tier": {
                                        "description": "owner|admin|member|viewer"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/roles/{role}": {
            "patch": {
                "summary": "Change a role (manifest roles: tier only)",
                "tags": [
                    "Roles"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "role",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    },
                                    "tier": {
                                        "description": "owner|admin|member|viewer"
                                    },
                                    "aliases": {
                                        "description": "old keys"
                                    },
                                    "assignable": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a role nobody holds",
                "tags": [
                    "Roles"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "role",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/roles/{role}/permissions": {
            "put": {
                "summary": "Set the exact permissions of a role",
                "tags": [
                    "Roles"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "role",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "permissions": {
                                        "description": "permission keys"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/webhooks": {
            "get": {
                "summary": "Webhook endpoints of the app",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Add an endpoint; the signing secret is in this response only",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "description": "https URL"
                                    },
                                    "events": {
                                        "description": "access.granted|access.changed|access.removed|user.updated|user.disabled|user.enabled|invite.accepted (empty = all)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/apps/{app}/webhooks/{id}": {
            "patch": {
                "summary": "Change URL or events, switch off/on (on = resend recent failures), rotate the secret",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "description": "https URL"
                                    },
                                    "events": {
                                        "description": "list"
                                    },
                                    "status": {
                                        "description": "active|disabled"
                                    },
                                    "rotate_secret": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove an endpoint",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/webhooks/{id}/deliveries": {
            "get": {
                "summary": "Recent deliveries (30 days; ?status=)",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/apps/{app}/webhooks/{id}/test": {
            "post": {
                "summary": "Send a ping now and see the answer",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/audit": {
            "get": {
                "summary": "Audit log (filters: category, event, org, user, since, until)",
                "tags": [
                    "Audit"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "audit:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/brand": {
            "get": {
                "summary": "Public: how an app names its sign-in (?app=<key> or ?client_id=<id>): level, account name, button text, logo, color, sign-in and account addresses",
                "tags": [
                    "Branding"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        },
        "/capabilities": {
            "get": {
                "summary": "What this token may do (display only)",
                "tags": [
                    "Meta"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": []
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/cimd/preview": {
            "get": {
                "summary": "Read a client ID metadata document (?url=) before registering it",
                "tags": [
                    "Apps"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/connections": {
            "get": {
                "summary": "Sign-in providers, SMS gateway and email senders (secrets masked; filter: org)",
                "tags": [
                    "Connections"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "connections:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Add a connection: oidc, oauth (org or platform), meta, sms (platform), email-smtp (org)",
                "tags": [
                    "Connections"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "connections:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "description": "oidc|oauth|meta|sms|email-smtp"
                                    },
                                    "name": {
                                        "description": "button label"
                                    },
                                    "org": {
                                        "description": "slug (omit = platform)"
                                    },
                                    "config": {
                                        "description": "issuer, client_id, client_secret, domains, jit, require\u2026 (see docs)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/connections/{key}": {
            "get": {
                "summary": "One connection, with the redirect URL to register at the provider",
                "tags": [
                    "Connections"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "connections:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change name, status or config (secrets: leave out to keep)",
                "tags": [
                    "Connections"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "connections:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "status": {
                                        "description": "active|disabled"
                                    },
                                    "config": {
                                        "description": "object"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a connection",
                "tags": [
                    "Connections"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "connections:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/export": {
            "get": {
                "summary": "An organization\u2019s setup as one JSON document (?org=): teams, fields, profiles, sign-in rules, its apps\u2019 roles and look, themes, messages, connections (secrets as ${secret:NAME})",
                "tags": [
                    "Config"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/flow/execute": {
            "post": {
                "summary": "App-native sign-in, one step at a time (no token; public client + PKCE). Start with client_id, redirect_uri, code_challenge, scope; then send flow_id + action: identify (email) \u2192 password | send_code (via) \u2192 code \u2192 totp | send_sms \u2192 sms \u2192 done (an authorization code for /oauth/token). step \"browser\" gives a URL when only the browser can continue.",
                "tags": [
                    "Sign-in"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "flow_id": {
                                        "description": "from the previous answer"
                                    },
                                    "client_id": {
                                        "description": "always"
                                    },
                                    "action": {
                                        "description": "identify|password|send_code|code|totp|send_sms|sms"
                                    },
                                    "email": {
                                        "description": "identify"
                                    },
                                    "password": {
                                        "description": "password"
                                    },
                                    "via": {
                                        "description": "email|sms"
                                    },
                                    "code": {
                                        "description": "code / totp / sms"
                                    },
                                    "redirect_uri": {
                                        "description": "start"
                                    },
                                    "code_challenge": {
                                        "description": "start (S256)"
                                    },
                                    "scope": {
                                        "description": "start"
                                    },
                                    "state": {
                                        "description": "start"
                                    },
                                    "nonce": {
                                        "description": "start"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/grants": {
            "get": {
                "summary": "Effective grants tokens are built from (filters: org, app, user)",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/health/live": {
            "get": {
                "summary": "The service is up",
                "tags": [
                    "Health"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        },
        "/health/ready": {
            "get": {
                "summary": "Database, cache and signing key are ready",
                "tags": [
                    "Health"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        },
        "/import": {
            "post": {
                "summary": "Import a document into an organization. dry_run (default true) lists what would change; dry_run=false applies it",
                "tags": [
                    "Config"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "org": {
                                        "description": "slug"
                                    },
                                    "document": {
                                        "description": "an export"
                                    },
                                    "dry_run": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invites": {
            "get": {
                "summary": "List invites (filters: status, org)",
                "tags": [
                    "Invites"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Invite someone into an organization; returns the invite link",
                "tags": [
                    "Invites"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "description": "string"
                                    },
                                    "name": {
                                        "description": "string"
                                    },
                                    "org": {
                                        "description": "slug"
                                    },
                                    "profiles": {
                                        "description": "profile keys"
                                    },
                                    "apps": {
                                        "description": "{app_key: role_key}"
                                    },
                                    "teams": {
                                        "description": "team keys"
                                    },
                                    "fields": {
                                        "description": "{key: value}"
                                    },
                                    "require_two_step": {
                                        "description": "bool"
                                    },
                                    "org_role": {
                                        "description": "member|developer|admin"
                                    },
                                    "send": {
                                        "description": "bool (default true)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invites/{invite}": {
            "delete": {
                "summary": "Revoke a pending invite",
                "tags": [
                    "Invites"
                ],
                "parameters": [
                    {
                        "name": "invite",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/invites/{invite}/resend": {
            "post": {
                "summary": "New link (the old one stops working) and email",
                "tags": [
                    "Invites"
                ],
                "parameters": [
                    {
                        "name": "invite",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "send": {
                                        "description": "bool (default true)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/languages": {
            "get": {
                "summary": "Languages of the sign-in pages and emails",
                "tags": [
                    "Languages & messages"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": []
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/languages/{lang}/translations": {
            "get": {
                "summary": "The wording in one language (built-in + your changes)",
                "tags": [
                    "Languages & messages"
                ],
                "parameters": [
                    {
                        "name": "lang",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": []
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "put": {
                "summary": "Change wording: {\"English text\": \"your text\" | null} (platform only)",
                "tags": [
                    "Languages & messages"
                ],
                "parameters": [
                    {
                        "name": "lang",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "<English text>": {
                                        "description": "your text, or null to undo"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me": {
            "get": {
                "summary": "Your account (personal token)",
                "tags": [
                    "Me"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change your name or phone",
                "tags": [
                    "Me"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "phone": {
                                        "description": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me/agents": {
            "get": {
                "summary": "Your own agents (they act for you, never with more access than you)",
                "tags": [
                    "Me"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Create your own agent in one of your organizations",
                "tags": [
                    "Me"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "org": {
                                        "description": "slug"
                                    },
                                    "description": {
                                        "description": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me/agents/{agent}": {
            "patch": {
                "summary": "Rename, suspend or resume your agent",
                "tags": [
                    "Me"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "status": {
                                        "description": "active|suspended"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete your agent",
                "tags": [
                    "Me"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/me/agents/{agent}/secret": {
            "post": {
                "summary": "New credentials for your agent",
                "tags": [
                    "Me"
                ],
                "parameters": [
                    {
                        "name": "agent",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/me/apps": {
            "get": {
                "summary": "Apps you can open, with your roles",
                "tags": [
                    "Me"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/me/consents": {
            "get": {
                "summary": "Outside apps you allowed to receive your details",
                "tags": [
                    "Me"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/me/consents/{app}": {
            "delete": {
                "summary": "Take that permission back",
                "tags": [
                    "Me"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/me/orgs/{org}/profile": {
            "get": {
                "summary": "Your teams and fields in one organization",
                "tags": [
                    "Me"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change the fields the organization lets you edit",
                "tags": [
                    "Me"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "fields": {
                                        "description": "{key: value}"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me/sessions": {
            "get": {
                "summary": "Browsers and apps you are signed in to",
                "tags": [
                    "Me"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/me/sessions/{id}": {
            "delete": {
                "summary": "Sign out one browser (web_\u2026) or app (app_\u2026)",
                "tags": [
                    "Me"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/openapi.json": {
            "get": {
                "summary": "This document",
                "tags": [
                    "Meta"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        },
        "/orgs": {
            "get": {
                "summary": "Organizations this client can see",
                "tags": [
                    "Organizations"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}": {
            "get": {
                "summary": "One organization ({org} = id or slug)",
                "tags": [
                    "Organizations"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/agents": {
            "get": {
                "summary": "The organization\u2019s agents (AI assistants, bots, scripts)",
                "tags": [
                    "Agents"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "agents:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Create an agent; the response has client_id and client_secret (shown once). It gets tokens with client credentials + audience=<app key>",
                "tags": [
                    "Agents"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "agents:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    },
                                    "apps": {
                                        "description": "{app_key: role_key}"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/alignment": {
            "get": {
                "summary": "Who has what: people \u00d7 apps (?format=csv)",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/branding": {
            "get": {
                "summary": "Branding: allowed and chosen level, account name, color, logo, support and legal links",
                "tags": [
                    "Organizations"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change the branding (up to the allowed level; `allowed` itself only for Clauth platform clients)",
                "tags": [
                    "Organizations"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "mode": {
                                        "description": "clauth|cobrand|whitelabel"
                                    },
                                    "account_name": {
                                        "description": "string"
                                    },
                                    "color": {
                                        "description": "#RRGGBB"
                                    },
                                    "support_email": {
                                        "description": "email"
                                    },
                                    "privacy_url": {
                                        "description": "https URL"
                                    },
                                    "terms_url": {
                                        "description": "https URL"
                                    },
                                    "allowed": {
                                        "description": "clauth|cobrand|whitelabel (platform only)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/fields": {
            "get": {
                "summary": "Profile fields the organization keeps about its people",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Add a profile field",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "description": "string"
                                    },
                                    "label": {
                                        "description": "string"
                                    },
                                    "type": {
                                        "description": "string|number|bool|date|enum"
                                    },
                                    "options": {
                                        "description": "choices (enum)"
                                    },
                                    "required": {
                                        "description": "bool"
                                    },
                                    "editable_by": {
                                        "description": "admin|self"
                                    },
                                    "in_token": {
                                        "description": "bool (send to apps)"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/fields/{field}": {
            "patch": {
                "summary": "Change a field (key and type are fixed)",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "field",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "label": {
                                        "description": "string"
                                    },
                                    "options": {
                                        "description": "choices"
                                    },
                                    "required": {
                                        "description": "bool"
                                    },
                                    "editable_by": {
                                        "description": "admin|self"
                                    },
                                    "in_token": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a field and its values",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "field",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/members": {
            "get": {
                "summary": "Members of the organization",
                "tags": [
                    "Organizations"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/members/{user}": {
            "put": {
                "summary": "Add an existing person (email or usr_ id) or change their org role",
                "tags": [
                    "Organizations"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "role": {
                                        "description": "member|developer|admin|owner"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove from the organization (their profiles, exceptions and grants there go too)",
                "tags": [
                    "Organizations"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/members/{user}/access": {
            "get": {
                "summary": "What the person gets in each app and why",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "put": {
                "summary": "Set profiles (exact list) and per-app exceptions, then work out grants",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "profiles": {
                                        "description": "profile keys"
                                    },
                                    "apps": {
                                        "description": "{app_key: \"profile\"|\"none\"|role_key}"
                                    },
                                    "reason": {
                                        "description": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/members/{user}/profile": {
            "get": {
                "summary": "A member's teams and field values (and missing required fields)",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Set a member's teams (exact list) and field values",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "teams": {
                                        "description": "team keys"
                                    },
                                    "fields": {
                                        "description": "{key: value|null}"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/policy": {
            "get": {
                "summary": "Sign-in rules of an organization (default for its apps): rules in force, where they come from, version",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "put": {
                "summary": "Replace the rules (new version)",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "password": {
                                        "description": "bool"
                                    },
                                    "google": {
                                        "description": "bool"
                                    },
                                    "connections": {
                                        "description": "\"all\" or keys"
                                    },
                                    "email_code": {
                                        "description": "bool"
                                    },
                                    "sms_code": {
                                        "description": "bool"
                                    },
                                    "two_step": {
                                        "description": "default|always"
                                    },
                                    "sms_second_step": {
                                        "description": "bool"
                                    },
                                    "registration": {
                                        "description": "invite|open (apps)"
                                    },
                                    "open_domains": {
                                        "description": "domains"
                                    },
                                    "open_profile": {
                                        "description": "profile key"
                                    },
                                    "check": {
                                        "description": "http connection key"
                                    },
                                    "check_fail_open": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove these rules so the next level applies",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/policy/restore": {
            "post": {
                "summary": "Restore a saved version (as a new version)",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "version": {
                                        "description": "int"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/policy/versions": {
            "get": {
                "summary": "Saved versions of these rules",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/profiles": {
            "get": {
                "summary": "Access profiles with their app roles and people",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Create an access profile",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "key": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    },
                                    "apps": {
                                        "description": "{app_key: role_key|\"none\"}"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/profiles/{profile}": {
            "get": {
                "summary": "One access profile ({profile} = key)",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "profile",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Rename or change the role per app (null = not set)",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "profile",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    },
                                    "apps": {
                                        "description": "{app_key: role_key|\"none\"|null}"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete; holders lose what only this profile gave them",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "profile",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/profiles/{profile}/people/{user}": {
            "put": {
                "summary": "Give the profile to a member",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "profile",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "delete": {
                "summary": "Take the profile away",
                "tags": [
                    "Access"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "profile",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "access:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/teams": {
            "get": {
                "summary": "Teams (stores, branches, departments) of the organization",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Add a team (its key is fixed; apps see it in tokens)",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "key": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orgs/{org}/teams/{team}": {
            "get": {
                "summary": "One team with its people",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "team",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Rename a team",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "team",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "description": {
                                        "description": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a team",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "team",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/orgs/{org}/teams/{team}/members/{user}": {
            "put": {
                "summary": "Put a member in the team",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "team",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "delete": {
                "summary": "Take a member out of the team",
                "tags": [
                    "Teams & fields"
                ],
                "parameters": [
                    {
                        "name": "org",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "team",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/policy": {
            "get": {
                "summary": "Sign-in rules of the platform: rules in force, where they come from, version",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "put": {
                "summary": "Replace the rules (new version)",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "password": {
                                        "description": "bool"
                                    },
                                    "google": {
                                        "description": "bool"
                                    },
                                    "connections": {
                                        "description": "\"all\" or keys"
                                    },
                                    "email_code": {
                                        "description": "bool"
                                    },
                                    "sms_code": {
                                        "description": "bool"
                                    },
                                    "two_step": {
                                        "description": "default|always"
                                    },
                                    "sms_second_step": {
                                        "description": "bool"
                                    },
                                    "registration": {
                                        "description": "invite|open (apps)"
                                    },
                                    "open_domains": {
                                        "description": "domains"
                                    },
                                    "open_profile": {
                                        "description": "profile key"
                                    },
                                    "check": {
                                        "description": "http connection key"
                                    },
                                    "check_fail_open": {
                                        "description": "bool"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Remove these rules so the next level applies",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/policy/restore": {
            "post": {
                "summary": "Restore a saved version (as a new version)",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "version": {
                                        "description": "int"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/policy/versions": {
            "get": {
                "summary": "Saved versions of these rules",
                "tags": [
                    "Sign-in rules"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/secrets": {
            "get": {
                "summary": "Secret names (?org=); values are never shown",
                "tags": [
                    "Config"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/secrets/{name}": {
            "put": {
                "summary": "Set a secret (${secret:NAME} in imports), stored encrypted",
                "tags": [
                    "Config"
                ],
                "parameters": [
                    {
                        "name": "name",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "value": {
                                        "description": "string"
                                    },
                                    "org": {
                                        "description": "slug (omit = platform)"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a secret",
                "tags": [
                    "Config"
                ],
                "parameters": [
                    {
                        "name": "name",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "org": {
                                        "description": "slug"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/settings": {
            "get": {
                "summary": "Platform settings (platform clients only)",
                "tags": [
                    "Settings"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change platform settings (platform clients only)",
                "tags": [
                    "Settings"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "settings:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "require_mfa_everyone": {
                                        "description": "bool"
                                    },
                                    "password_min_length": {
                                        "description": "int"
                                    },
                                    "session_idle_hours": {
                                        "description": "int"
                                    },
                                    "\u2026": {
                                        "description": "see GET /settings"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/templates": {
            "get": {
                "summary": "Message templates (?org=): invite, login_code, new_device, lockout (email), sms_code (text)",
                "tags": [
                    "Languages & messages"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/templates/{key}": {
            "put": {
                "summary": "Write a message (an organization: its invite; the platform: all)",
                "tags": [
                    "Languages & messages"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "org": {
                                        "description": "slug (omit = platform)"
                                    },
                                    "locale": {
                                        "description": "en|fil"
                                    },
                                    "subject": {
                                        "description": "email subject"
                                    },
                                    "body": {
                                        "description": "plain text with {{placeholders}}"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Go back to the built-in message",
                "tags": [
                    "Languages & messages"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "orgs:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "org": {
                                        "description": "slug"
                                    },
                                    "locale": {
                                        "description": "en|fil"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/themes": {
            "get": {
                "summary": "Built-in styles and designed sign-in themes you can use",
                "tags": [
                    "Themes"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "post": {
                "summary": "Design a theme",
                "tags": [
                    "Themes"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "org": {
                                        "description": "slug (omit = platform)"
                                    },
                                    "base": {
                                        "description": "classic|daylight|midnight|auto"
                                    },
                                    "accent": {
                                        "description": "#rrggbb"
                                    },
                                    "background": {
                                        "description": "#rrggbb"
                                    },
                                    "card": {
                                        "description": "#rrggbb"
                                    },
                                    "font": {
                                        "description": "Inter|Manrope|Poppins|\u2026"
                                    },
                                    "heading_font": {
                                        "description": "font"
                                    },
                                    "radius": {
                                        "description": "0\u201328"
                                    },
                                    "buttons": {
                                        "description": "rounded|pill|square"
                                    },
                                    "layout": {
                                        "description": "center|split"
                                    },
                                    "tagline": {
                                        "description": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/themes/resolve": {
            "get": {
                "summary": "What a sign-in page will look like (?app=, ?domain=): computed colors, fonts, layout",
                "tags": [
                    "Themes"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/themes/{key}": {
            "get": {
                "summary": "One designed theme",
                "tags": [
                    "Themes"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change a theme (apps using it change too)",
                "tags": [
                    "Themes"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "\u2026": {
                                        "description": "any setting"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a theme (its apps go back to their built-in style)",
                "tags": [
                    "Themes"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/themes/{key}/usages": {
            "get": {
                "summary": "Apps and domains using the theme",
                "tags": [
                    "Themes"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "apps:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/users": {
            "get": {
                "summary": "List people (filters: status, org, app, q)",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "next_cursor from the previous page"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/users/{user}": {
            "get": {
                "summary": "One person with orgs, grants, profiles and sign-in methods ({user} = usr_ id or email)",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": []
                    },
                    {
                        "personalToken": []
                    }
                ]
            },
            "patch": {
                "summary": "Change name or phone (email: platform clients only)",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "description": "string"
                                    },
                                    "phone": {
                                        "description": "string|null"
                                    },
                                    "email": {
                                        "description": "string (platform only)"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete an account everywhere (platform only; frees the email, keeps an anonymised row)",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/users/{user}/{action}": {
            "post": {
                "summary": "disable | enable | unlock | reset-two-step | two-step-exempt | two-step-required | sign-out | password-reset",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "action",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "users:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/variables": {
            "get": {
                "summary": "Variables (?org=)",
                "tags": [
                    "Config"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:read"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ]
            }
        },
        "/variables/{name}": {
            "put": {
                "summary": "Set a variable (${var:NAME} in imports)",
                "tags": [
                    "Config"
                ],
                "parameters": [
                    {
                        "name": "name",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "value": {
                                        "description": "string"
                                    },
                                    "org": {
                                        "description": "slug (omit = platform)"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a variable",
                "tags": [
                    "Config"
                ],
                "parameters": [
                    {
                        "name": "name",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "default": {
                        "description": "Error",
                        "content": {
                            "application/problem+json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Problem"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "clientCredentials": [
                            "config:write"
                        ]
                    },
                    {
                        "personalToken": []
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "org": {
                                        "description": "slug"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "clientCredentials": {
                "type": "oauth2",
                "flows": {
                    "clientCredentials": {
                        "tokenUrl": "https://app.helloclauth.com/oauth/token",
                        "scopes": {
                            "users:read": "Look up users (machine-to-machine)",
                            "users:write": "Manage people: invite, update, lock, disable (API)",
                            "orgs:read": "Read organizations and members (API)",
                            "orgs:write": "Add and remove members (API)",
                            "apps:read": "Read apps, roles and permissions (API)",
                            "apps:write": "Sync manifests, rotate and revoke app clients (API)",
                            "access:read": "Read grants, access profiles and who has what (API)",
                            "access:write": "Change access profiles and people's access (API)",
                            "audit:read": "Read the audit log (API)",
                            "connections:read": "Read sign-in providers, SMS gateway and email senders (API)",
                            "connections:write": "Add and change sign-in providers, SMS gateway and email senders (API)",
                            "agents:read": "Read the organization\u2019s agents (API)",
                            "agents:write": "Create agents, give them roles, rotate their secrets (API)",
                            "config:read": "Export an organization\u2019s setup; read variables (API)",
                            "config:write": "Import a setup; set variables and secrets (API)",
                            "authzen": "Ask \"can this person do X in this app?\" (AuthZEN access evaluation)",
                            "scim": "Provision people and groups with SCIM 2.0 (HR systems, Google Workspace, Entra, Okta)",
                            "settings:read": "Read platform settings (API, platform clients only)",
                            "settings:write": "Change platform settings (API, platform clients only)"
                        }
                    }
                }
            },
            "personalToken": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT",
                "description": "Personal API token from My account \u203a API tokens. Acts as you; also unlocks /me (me:read, me:write)."
            }
        },
        "schemas": {
            "Problem": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "status": {
                        "type": "integer"
                    },
                    "detail": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object"
                    },
                    "request_id": {
                        "type": "string"
                    }
                }
            }
        }
    }
}