Memoy Bank

Memoy Bank · Actions GPT

MemoryBank API

API for managing documents and user accounts in MemoryBank.

  • POST /addAdd new document.
  • POST /updateUpdate existing document using its id.
  • POST /queryQueries documents based on filters.
  • POST /deleteDeletes documents based on IDs or filters.
  • POST /deleteAccountDeletes a user's account and all related documents.
Schéma original API
{
  "openapi": "3.0.0",
  "info": {
    "title": "MemoryBank API",
    "description": "API for managing documents and user accounts in MemoryBank.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://gpt.memorybank.app",
      "description": "Main production server"
    }
  ],
  "components": {
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://memorybank.app/gpt/login",
            "tokenUrl": "https://gpt.memorybank.app/exchange",
            "scopes": {}
          }
        }
      }
    },
    "schemas": {
      "Source": {
        "type": "string",
        "enum": [
          "email",
          "file",
          "chat",
          "text",
          "user",
          "assistant",
          "event",
          "reminder"
        ]
      },
      "DocumentMetadata": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "source_id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "author": {
            "type": "string"
          }
        }
      },
      "DocumentChunkMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DocumentMetadata"
          },
          {
            "type": "object",
            "properties": {
              "document_id": {
                "type": "string"
              }
            }
          }
        ]
      },
      "DocumentChunk": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/DocumentChunkMetadata"
          },
          "embedding": {
            "type": "array",
            "items": {
              "type": "number"
            }
          }
        }
      },
      "DocumentChunkWithScore": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DocumentChunk"
          },
          {
            "type": "object",
            "properties": {
              "score": {
                "type": "number"
              }
            }
          }
        ]
      },
      "Document": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/DocumentMetadata"
          }
        }
      },
      "DocumentWithChunks": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Document"
          },
          {
            "type": "object",
            "properties": {
              "chunks": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DocumentChunk"
                }
              }
            }
          }
        ]
      },
      "DocumentMetadataFilter": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string"
          },
          "document_id": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "source_id": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          }
        }
      },
      "Query": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "filter": {
            "$ref": "#/components/schemas/DocumentMetadataFilter"
          },
          "top_k": {
            "type": "integer"
          }
        }
      },
      "QueryWithEmbedding": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Query"
          },
          {
            "type": "object",
            "properties": {
              "embedding": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              }
            }
          }
        ]
      },
      "QueryResult": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentChunkWithScore"
            }
          }
        }
      },
      "UpsertRequest": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Document"
            }
          }
        }
      },
      "UpsertResponse": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "QueryRequest": {
        "type": "object",
        "properties": {
          "queries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Query"
            }
          }
        }
      },
      "QueryResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QueryResult"
            }
          }
        }
      },
      "DeleteRequest": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "filter": {
            "$ref": "#/components/schemas/DocumentMetadataFilter"
          }
        }
      },
      "DeleteResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        }
      }
    }
  },
  "paths": {
    "/add": {
      "post": {
        "operationId": "addDocument",
        "summary": "Add new document.",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document add successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpsertResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": []
          }
        ]
      }
    },
    "/update": {
      "post": {
        "operationId": "updateDocument",
        "summary": "Update existing document using its id.",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document update successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpsertResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": []
          }
        ]
      }
    },
    "/query": {
      "post": {
        "operationId": "queryDocuments",
        "summary": "Queries documents based on filters.",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Query successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": []
          }
        ]
      }
    },
    "/delete": {
      "post": {
        "operationId": "deleteDocument",
        "summary": "Deletes documents based on IDs or filters.",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Delete successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": []
          }
        ]
      }
    },
    "/deleteAccount": {
      "post": {
        "operationId": "deleteAccount",
        "summary": "Deletes a user's account and all related documents.",
        "x-openai-isConsequential": true,
        "responses": {
          "200": {
            "description": "Account deletion successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": []
          }
        ]
      }
    }
  }
}