mastra

GitHub

Mastra is the modern TypeScript framework for AI-powered applications and agents.

Raw JSON API

Mastra API Specification

Located in packages/deployer/src/server/openapi.json on branch HEAD

3.1.0 JSON 24 Endpoints 16.1 KB

Operations & Route Endpoints (28)

GET /api
getApi
GET /api/agents
getApiAgents
GET /api/agents/{agentId}
getApiAgentsByAgentId
POST /api/agents/{agentId}/generate
postApiAgentsByAgentIdGenerate
POST /api/agents/{agentId}/stream
postApiAgentsByAgentIdStream
POST /api/agents/{agentId}/tools/{toolId}/execute
postApiAgentsByAgentIdToolsByToolIdExecute
GET /api/memory/status
getApiMemoryStatus
GET /api/memory/threads
getApiMemoryThreads
POST /api/memory/threads
postApiMemoryThreads
GET /api/memory/threads/{threadId}
getApiMemoryThreadsByThreadId
PATCH /api/memory/threads/{threadId}
patchApiMemoryThreadsByThreadId
DELETE /api/memory/threads/{threadId}
deleteApiMemoryThreadsByThreadId
GET /api/memory/threads/{threadId}/messages
getApiMemoryThreadsByThreadIdMessages
POST /api/memory/save-messages
postApiMemorySave-messages
GET /api/workflows
getApiWorkflows
GET /api/workflows/{workflowId}
getApiWorkflowsByWorkflowId
POST /api/workflows/{workflowId}/execute
postApiWorkflowsByWorkflowIdExecute
GET /api/logs
getApiLogs
GET /api/logs/{runId}
getApiLogsByRunId
GET /api/tools
getApiTools
GET /api/tools/{toolId}
getApiToolsByToolId
POST /api/tools/{toolId}/execute
postApiToolsByToolIdExecute
POST /api/vector/{vectorName}/upsert
postApiVectorByVectorNameUpsert
POST /api/vector/{vectorName}/create-index
postApiVectorByVectorNameCreate-index
POST /api/vector/{vectorName}/query
postApiVectorByVectorNameQuery
GET /api/vector/{vectorName}/indexes
getApiVectorByVectorNameIndexes
GET /api/vector/{vectorName}/indexes/{indexName}
getApiVectorByVectorNameIndexesByIndexName
DELETE /api/vector/{vectorName}/indexes/{indexName}
deleteApiVectorByVectorNameIndexesByIndexName
Raw JSON Specification
{
  "openapi": "3.1.0",
  "info": {
    "title": "Mastra API",
    "description": "Mastra API",
    "version": "1.0.0"
  },
  "paths": {
    "/api": {
      "get": {
        "responses": {
          "200": {
            "description": "Success"
          }
        },
        "operationId": "getApi",
        "description": "Get API status",
        "tags": [
          "system"
        ]
      }
    },
    "/api/agents": {
      "get": {
        "responses": {
          "200": {
            "description": "List of all agents"
          }
        },
        "operationId": "getApiAgents",
        "description": "Get all available agents",
        "tags": [
          "agents"
        ]
      }
    },
    "/api/agents/{agentId}": {
      "get": {
        "responses": {
          "200": {
            "description": "Agent details"
          },
          "404": {
            "description": "Agent not found"
          }
        },
        "operationId": "getApiAgentsByAgentId",
        "description": "Get agent by ID",
        "tags": [
          "agents"
        ],
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/agents/{agentId}/generate": {
      "post": {
        "responses": {
          "200": {
            "description": "Generated response"
          },
          "404": {
            "description": "Agent not found"
          }
        },
        "operationId": "postApiAgentsByAgentIdGenerate",
        "description": "Generate a response from an agent",
        "tags": [
          "agents"
        ],
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "threadId": {
                    "type": "string"
                  },
                  "resourceId": {
                    "type": "string",
                    "description": "The resource ID for the conversation"
                  },
                  "resourceid": {
                    "type": "string",
                    "description": "The resource ID for the conversation (deprecated, use resourceId instead)",
                    "deprecated": true
                  },
                  "output": {
                    "type": "object"
                  }
                },
                "required": [
                  "messages"
                ]
              }
            }
          }
        }
      }
    },
    "/api/agents/{agentId}/stream": {
      "post": {
        "responses": {
          "200": {
            "description": "Streamed response"
          },
          "404": {
            "description": "Agent not found"
          }
        },
        "operationId": "postApiAgentsByAgentIdStream",
        "description": "Stream a response from an agent",
        "tags": [
          "agents"
        ],
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "threadId": {
                    "type": "string"
                  },
                  "resourceId": {
                    "type": "string",
                    "description": "The resource ID for the conversation"
                  },
                  "resourceid": {
                    "type": "string",
                    "description": "The resource ID for the conversation (deprecated, use resourceId instead)",
                    "deprecated": true
                  },
                  "output": {
                    "type": "object"
                  }
                },
                "required": [
                  "messages"
                ]
              }
            }
          }
        }
      }
    },
    "/api/agents/{agentId}/tools/{toolId}/execute": {
      "post": {
        "responses": {
          "200": {
            "description": "Tool execution result"
          },
          "404": {
            "description": "Tool or agent not found"
          }
        },
        "operationId": "postApiAgentsByAgentIdToolsByToolIdExecute",
        "description": "Execute a tool through an agent",
        "tags": [
          "agents"
        ],
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "toolId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "args": {
                    "type": "object"
                  },
                  "threadId": {
                    "type": "string"
                  },
                  "resourceid": {
                    "type": "string"
                  }
                },
                "required": [
                  "args"
                ]
              }
            }
          }
        }
      }
    },
    "/api/memory/status": {
      "get": {
        "responses": {
          "200": {
            "description": "Memory status"
          }
        },
        "operationId": "getApiMemoryStatus",
        "description": "Get memory status",
        "tags": [
          "memory"
        ]
      }
    },
    "/api/memory/threads": {
      "get": {
        "responses": {
          "200": {
            "description": "List of all threads"
          }
        },
        "operationId": "getApiMemoryThreads",
        "description": "Get all threads",
        "tags": [
          "memory"
        ],
        "parameters": [
          {
            "name": "resourceid",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "post": {
        "responses": {
          "200": {
            "description": "Created thread"
          }
        },
        "operationId": "postApiMemoryThreads",
        "description": "Create a new thread",
        "tags": [
          "memory"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object"
                  },
                  "resourceid": {
                    "type": "string"
                  },
                  "threadId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/memory/threads/{threadId}": {
      "get": {
        "responses": {
          "200": {
            "description": "Thread details"
          },
          "404": {
            "description": "Thread not found"
          }
        },
        "operationId": "getApiMemoryThreadsByThreadId",
        "description": "Get thread by ID",
        "tags": [
          "memory"
        ],
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "responses": {
          "200": {
            "description": "Updated thread"
          },
          "404": {
            "description": "Thread not found"
          }
        },
        "operationId": "patchApiMemoryThreadsByThreadId",
        "description": "Update a thread",
        "tags": [
          "memory"
        ],
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        }
      },
      "delete": {
        "responses": {
          "200": {
            "description": "Thread deleted"
          },
          "404": {
            "description": "Thread not found"
          }
        },
        "operationId": "deleteApiMemoryThreadsByThreadId",
        "description": "Delete a thread",
        "tags": [
          "memory"
        ],
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/memory/threads/{threadId}/messages": {
      "get": {
        "responses": {
          "200": {
            "description": "List of messages"
          }
        },
        "operationId": "getApiMemoryThreadsByThreadIdMessages",
        "description": "Get messages for a thread",
        "tags": [
          "memory"
        ],
        "parameters": [
          {
            "name": "threadId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/memory/save-messages": {
      "post": {
        "responses": {
          "200": {
            "description": "Messages saved"
          }
        },
        "operationId": "postApiMemorySave-messages",
        "description": "Save messages",
        "tags": [
          "memory"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                },
                "required": [
                  "messages"
                ]
              }
            }
          }
        }
      }
    },
    "/api/workflows": {
      "get": {
        "responses": {
          "200": {
            "description": "List of all workflows"
          }
        },
        "operationId": "getApiWorkflows",
        "description": "Get all workflows",
        "tags": [
          "workflows"
        ]
      }
    },
    "/api/workflows/{workflowId}": {
      "get": {
        "responses": {
          "200": {
            "description": "Workflow details"
          },
          "404": {
            "description": "Workflow not found"
          }
        },
        "operationId": "getApiWorkflowsByWorkflowId",
        "description": "Get workflow by ID",
        "tags": [
          "workflows"
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/workflows/{workflowId}/execute": {
      "post": {
        "responses": {
          "200": {
            "description": "Workflow execution result"
          },
          "404": {
            "description": "Workflow not found"
          }
        },
        "operationId": "postApiWorkflowsByWorkflowIdExecute",
        "description": "Execute a workflow",
        "tags": [
          "workflows"
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "object"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/logs": {
      "get": {
        "responses": {
          "200": {
            "description": "List of all logs"
          }
        },
        "operationId": "getApiLogs",
        "description": "Get all logs",
        "tags": [
          "logs"
        ],
        "parameters": [
          {
            "name": "transportId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/logs/{runId}": {
      "get": {
        "responses": {
          "200": {
            "description": "List of logs for run ID"
          }
        },
        "operationId": "getApiLogsByRunId",
        "description": "Get logs by run ID",
        "tags": [
          "logs"
        ],
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transportId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/tools": {
      "get": {
        "responses": {
          "200": {
            "description": "List of all tools"
          }
        },
        "operationId": "getApiTools",
        "description": "Get all tools",
        "tags": [
          "tools"
        ]
      }
    },
    "/api/tools/{toolId}": {
      "get": {
        "responses": {
          "200": {
            "description": "Tool details"
          },
          "404": {
            "description": "Tool not found"
          }
        },
        "operationId": "getApiToolsByToolId",
        "description": "Get tool by ID",
        "tags": [
          "tools"
        ],
        "parameters": [
          {
            "name": "toolId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/tools/{toolId}/execute": {
      "post": {
        "responses": {
          "200": {
            "description": "Tool execution result"
          },
          "404": {
            "description": "Tool not found"
          }
        },
        "operationId": "postApiToolsByToolIdExecute",
        "description": "Execute a tool",
        "tags": [
          "tools"
        ],
        "parameters": [
          {
            "name": "toolId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "args": {
                    "type": "object"
                  },
                  "threadId": {
                    "type": "string"
                  },
                  "resourceid": {
                    "type": "string"
                  }
                },
                "required": [
                  "args"
                ]
              }
            }
          }
        }
      }
    },
    "/api/vector/{vectorName}/upsert": {
      "post": {
        "responses": {
          "200": {
            "description": "Vectors upserted successfully"
          }
        },
        "operationId": "postApiVectorByVectorNameUpsert",
        "description": "Upsert vectors into an index",
        "tags": [
          "vector"
        ],
        "parameters": [
          {
            "name": "vectorName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "indexName": {
                    "type": "string"
                  },
                  "vectors": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    }
                  },
                  "metadata": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "indexName",
                  "vectors"
                ]
              }
            }
          }
        }
      }
    },
    "/api/vector/{vectorName}/create-index": {
      "post": {
        "responses": {
          "200": {
            "description": "Index created successfully"
          }
        },
        "operationId": "postApiVectorByVectorNameCreate-index",
        "description": "Create a new vector index",
        "tags": [
          "vector"
        ],
        "parameters": [
          {
            "name": "vectorName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "indexName": {
                    "type": "string"
                  },
                  "dimension": {
                    "type": "number"
                  },
                  "metric": {
                    "type": "string",
                    "enum": [
                      "cosine",
                      "euclidean",
                      "dotproduct"
                    ]
                  }
                },
                "required": [
                  "indexName",
                  "dimension"
                ]
              }
            }
          }
        }
      }
    },
    "/api/vector/{vectorName}/query": {
      "post": {
        "responses": {
          "200": {
            "description": "Query results"
          }
        },
        "operationId": "postApiVectorByVectorNameQuery",
        "description": "Query vectors from an index",
        "tags": [
          "vector"
        ],
        "parameters": [
          {
            "name": "vectorName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "indexName": {
                    "type": "string"
                  },
                  "queryVector": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  },
                  "topK": {
                    "type": "number"
                  },
                  "filter": {
                    "type": "object"
                  },
                  "includeVector": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "indexName",
                  "queryVector"
                ]
              }
            }
          }
        }
      }
    },
    "/api/vector/{vectorName}/indexes": {
      "get": {
        "responses": {
          "200": {
            "description": "List of indexes"
          }
        },
        "operationId": "getApiVectorByVectorNameIndexes",
        "description": "List all indexes for a vector store",
        "tags": [
          "vector"
        ],
        "parameters": [
          {
            "name": "vectorName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/vector/{vectorName}/indexes/{indexName}": {
      "get": {
        "responses": {
          "200": {
            "description": "Index details"
          }
        },
        "operationId": "getApiVectorByVectorNameIndexesByIndexName",
        "description": "Get details about a specific index",
        "tags": [
          "vector"
        ],
        "parameters": [
          {
            "name": "vectorName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "indexName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "delete": {
        "responses": {
          "200": {
            "description": "Index deleted successfully"
          }
        },
        "operationId": "deleteApiVectorByVectorNameIndexesByIndexName",
        "description": "Delete a specific index",
        "tags": [
          "vector"
        ],
        "parameters": [
          {
            "name": "vectorName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "indexName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {}
  }
}