{
  "openapi": "3.1.0",
  "info": {
    "title": "MindCloud Public API v1",
    "version": "1.0.0",
    "description": "Documented REST surface under /v1. Authenticate with a MindCloud API key sent as a bearer token unless an endpoint says otherwise."
  },
  "servers": [
    {
      "url": "https://connect.mindcloud.co"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v1/users": {
      "get": {
        "operationId": "v1-list-users",
        "summary": "List users",
        "description": "Returns every member of your company at once, without filters or pagination.",
        "tags": [
          "users"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "userId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "v1-create-end-user",
        "summary": "Create an end user",
        "description": "Create an embedded end user for your company. Your backend calls this before opening an embedded session for someone.",
        "tags": [
          "embedded"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The end user's display name."
                  },
                  "email": {
                    "type": "string",
                    "description": "The end user's email address."
                  },
                  "externalId": {
                    "type": "string",
                    "description": "Your own id for this person, so you can find them again."
                  },
                  "isTestUser": {
                    "type": "boolean",
                    "description": "True to link this end user to your workspace for testing."
                  },
                  "metadata": {
                    "type": "object",
                    "description": "Per-end-user host variables for credential exchange."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/users/{userId}/token": {
      "get": {
        "operationId": "v1-get-end-user-token",
        "summary": "Get an End User Token",
        "description": "Exchange an end user id for the JWT that boots their embedded session. Call it from your backend and hand the token to the SDK.",
        "tags": [
          "embedded"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The end user's id, from Create an end user."
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/installation/apps/{appId}/{appVersion}/action/{actionId}/run": {
      "post": {
        "operationId": "v1-run-app-action",
        "summary": "Run an app action",
        "description": "Run an app action with an installation's credentials, from your own backend. Authenticates with an End User Token instead of an API key.",
        "tags": [
          "embedded"
        ],
        "security": [
          {
            "endUserToken": []
          }
        ],
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The id of the app the action belongs to."
          },
          {
            "name": "appVersion",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The app version to run: published, draft, or a numbered version."
          },
          {
            "name": "actionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The id of the action to run."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "installationId"
                ],
                "properties": {
                  "installationId": {
                    "type": "string",
                    "description": "The installation whose credentials the action runs with."
                  },
                  "actionArguments": {
                    "type": "object",
                    "description": "Arguments for the action, if it takes any."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The action result. Shape depends on the action.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "operationId": "v1-get-openapi-document",
        "summary": "Get this OpenAPI document",
        "description": "The OpenAPI 3.1 document describing the documented v1 surface. No authentication required.",
        "tags": [
          "meta"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies": {
      "get": {
        "operationId": "v1-list-companies",
        "summary": "List companies",
        "description": "See your company's profile, plan, and member count.",
        "tags": [
          "companies"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/fields"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "name": "where",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "RSQL filter expression. Available fields: id, name, description, isPersonal, timezone, settings, isDeleted, createdOn, updatedOn, plan, stripeSubscriptionProductId, subscriptionIsLegacy, subscriptionUpdatedOn, memberCount. Operators: ==, !=, >, >=, <, <=, =in=, =out=, =like=. Logical: ; (AND), , (OR). Example: \"status==active;name=like=Sales\""
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {},
                          "name": {},
                          "description": {},
                          "isPersonal": {},
                          "timezone": {},
                          "settings": {},
                          "isDeleted": {},
                          "createdOn": {},
                          "updatedOn": {},
                          "plan": {},
                          "stripeSubscriptionProductId": {},
                          "subscriptionIsLegacy": {},
                          "subscriptionUpdatedOn": {},
                          "memberCount": {}
                        }
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "MindCloud API key, sent as a bearer token."
      },
      "endUserToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "End User Token from GET /v1/users/{userId}/token, sent as a bearer token."
      }
    },
    "parameters": {
      "fields": {
        "name": "fields",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Comma-separated list of fields to return (e.g. \"id,name,status\")."
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "default": 100
        },
        "description": "Maximum number of results to return (1-1000, default 100)."
      },
      "offset": {
        "name": "offset",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "description": "Number of results to skip for pagination (default 0)."
      },
      "sort": {
        "name": "sort",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Comma-separated sort fields. Prefix with - for descending (e.g. \"-createdOn,name\")."
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "ListMeta": {
        "type": "object",
        "properties": {
          "pagination": {
            "type": "object",
            "properties": {
              "totalCount": {
                "type": "integer"
              },
              "hasNextPage": {
                "type": "boolean"
              },
              "hasPreviousPage": {
                "type": "boolean"
              }
            }
          }
        }
      }
    }
  }
}