{
  "openapi": "3.1.0",
  "info": {
    "title": "Telemio Developer Connect API",
    "version": "1.0.0",
    "description": "Read-only workspace-scoped API. Use a read-scoped Telemio credential."
  },
  "servers": [
    {
      "url": "https://api.telemio.sh/api/integrations/v1"
    }
  ],
  "security": [
    {
      "BearerReadToken": []
    }
  ],
  "paths": {
    "/workspaces": {
      "get": {
        "operationId": "listIntegrationWorkspaces",
        "summary": "List workspaces available to the credential",
        "responses": {
          "200": {
            "description": "Authorized workspaces",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "workspaces": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Workspace"
                          }
                        }
                      },
                      "required": [
                        "workspaces"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authorization required"
          },
          "403": {
            "description": "Read scope required"
          }
        }
      }
    },
    "/workspaces/{workspaceId}/summary": {
      "get": {
        "operationId": "getIntegrationSummary",
        "summary": "Read a one-hour workspace summary",
        "parameters": [
          {
            "$ref": "#/components/parameters/workspaceId"
          }
        ],
        "responses": {
          "200": {
            "description": "One-hour overview",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "workspaceId": {
                          "type": "string"
                        },
                        "summary": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "workspaceId",
                        "summary"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Workspace not available to credential"
          }
        }
      }
    },
    "/workspaces/{workspaceId}/runtimes": {
      "get": {
        "operationId": "listIntegrationRuntimes",
        "summary": "Read a bounded list of recent runtime sessions",
        "parameters": [
          {
            "$ref": "#/components/parameters/workspaceId"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "completed",
                "failed",
                "cancelled",
                "revoked",
                "expired"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Runtime sessions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "workspaceId": {
                          "type": "string"
                        },
                        "sessions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "summary": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      },
                      "required": [
                        "workspaceId",
                        "sessions",
                        "summary"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter"
          },
          "404": {
            "description": "Workspace not available to credential"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerReadToken": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "parameters": {
      "workspaceId": {
        "name": "workspaceId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^ws_[a-zA-Z0-9_-]{6,100}$"
        }
      }
    },
    "schemas": {
      "Workspace": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      }
    }
  }
}
