openapi: 3.0.1 info: title: Mem0 API Docs agents exports API description: mem0.ai API Docs contact: email: support@mem0.ai license: name: Apache 2.0 version: v1 servers: - url: https://api.mem0.ai/ security: - ApiKeyAuth: [] tags: - name: exports paths: /v1/exports/: post: tags: - exports summary: Create an export job with schema description: Create a structured export of memories based on a provided schema. operationId: exports_create requestBody: content: application/json: schema: type: object required: - schema properties: schema: type: object description: Schema definition for the export filters: type: object properties: user_id: type: string agent_id: type: string app_id: type: string run_id: type: string description: 'Filters to apply while exporting memories. Available fields are: user_id, agent_id, app_id, run_id.' org_id: type: string description: Filter exports by organization ID. project_id: type: string description: Filter exports by project ID. required: true responses: '201': description: Export created successfully. content: application/json: schema: type: object properties: message: type: string example: Memory export request received. The export will be ready in a few seconds. id: type: string format: uuid example: 550e8400-e29b-41d4-a716-446655440000 required: - message - id '400': description: Bad Request. content: application/json: schema: type: object properties: message: type: string example: Schema is required and must be a valid object x-code-samples: - lang: Python source: "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\n\nclient = MemoryClient(api_key=\"your_api_key\")\n\njson_schema = {pydantic_json_schema}\nfilters = {\n \"AND\": [\n {\"user_id\": \"alex\"}\n ]\n}\n\nresponse = client.create_memory_export(\n schema=json_schema,\n filters=filters\n)\nprint(response)" - lang: JavaScript source: "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst jsonSchema = {pydantic_json_schema};\nconst filters = {\n AND: [\n {user_id: 'alex'}\n ]\n};\n\nclient.createMemoryExport({\n schema: jsonSchema,\n filters: filters\n})\n .then(result => console.log(result))\n .catch(error => console.error(error));" - lang: cURL source: "curl --request POST \\\n --url 'https://api.mem0.ai/v1/exports/' \\\n --header 'Authorization: Token ' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"schema\": {pydantic_json_schema},\n \"filters\": {\n \"AND\": [\n {\"user_id\": \"alex\"}\n ]\n }\n }'" - lang: Go source: "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\turl := \"https://api.mem0.ai/v1/exports/\"\n\n\tfilters := map[string]interface{}{\n\t\t\"AND\": []map[string]interface{}{\n\t\t\t{\"user_id\": \"alex\"},\n\t\t},\n\t}\n\n\tdata := map[string]interface{}{\n\t\t\"schema\": map[string]interface{}{}, // Your schema here\n\t\t\"filters\": filters,\n\t}\n\n\tjsonData, _ := json.Marshal(data)\n\n\treq, _ := http.NewRequest(\"POST\", url, bytes.NewBuffer(jsonData))\n\n\treq.Header.Add(\"Authorization\", \"Token \")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(string(body))\n}" - lang: PHP source: " [\n ['user_id' => 'alex']\n ]\n];\n\n$data = array(\n \"schema\" => array(), // Your schema here\n \"filters\" => $filters\n);\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/exports/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => json_encode($data),\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token \",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}" - lang: Java source: "import com.mashape.unirest.http.HttpResponse;\nimport com.mashape.unirest.http.JsonNode;\nimport com.mashape.unirest.http.Unirest;\nimport org.json.JSONObject;\nimport org.json.JSONArray;\n\nJSONObject filters = new JSONObject()\n .put(\"AND\", new JSONArray()\n .put(new JSONObject().put(\"user_id\", \"alex\")));\n\nJSONObject data = new JSONObject()\n .put(\"schema\", new JSONObject()) // Your schema here\n .put(\"filters\", filters);\n\nHttpResponse response = Unirest.post(\"https://api.mem0.ai/v1/exports/\")\n .header(\"Authorization\", \"Token \")\n .header(\"Content-Type\", \"application/json\")\n .body(data.toString())\n .asJson();" /v1/exports/get: post: tags: - exports summary: Export data based on filters description: Get the latest memory export. operationId: exports_list requestBody: content: application/json: schema: type: object properties: memory_export_id: type: string description: The unique identifier of the memory export. filters: type: object properties: user_id: type: string agent_id: type: string app_id: type: string run_id: type: string created_at: type: string updated_at: type: string description: 'Filters to apply while exporting memories. Available fields are: user_id, agent_id, app_id, run_id, created_at, updated_at.' org_id: type: string description: Filter exports by organization ID. project_id: type: string description: Filter exports by project ID. responses: '200': description: Successful export. content: application/json: schema: type: object description: Export data response in an object format. '400': description: Bad Request. content: application/json: schema: type: object properties: message: type: string example: 'One of the filters: app_id, user_id, agent_id, run_id is required!' '404': description: Not Found. content: application/json: schema: type: object properties: error: type: string example: No memory export request found x-code-samples: - lang: Python source: '# To use the Python SDK, install the package: # pip install mem0ai from mem0 import MemoryClient client = MemoryClient(api_key="your_api_key") memory_export_id = "" response = client.get_memory_export(memory_export_id=memory_export_id) print(response)' - lang: JavaScript source: "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst memory_export_id = \"\";\n\n// Get memory export\nclient.getMemoryExport({ memory_export_id })\n .then(result => console.log(result))\n .catch(error => console.error(error));" - lang: cURL source: "curl --request POST \\\n --url 'https://api.mem0.ai/v1/exports/get/' \\\n --header 'Authorization: Token ' \\\n --data '{\n \"memory_export_id\": \"\"\n}'" - lang: Go source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\tmemory_export_id := \"\"\n\n\treq, _ := http.NewRequest(\"POST\", \"https://api.mem0.ai/v1/exports/get/\", nil)\n\n\treq.Header.Add(\"Authorization\", \"Token \")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(string(body))\n}" - lang: PHP source: " '']);\n\ncurl_setopt_array($curl, [\n CURLOPT_URL => \"https://api.mem0.ai/v1/exports/get/\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_POSTFIELDS => $data,\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token \",\n \"Content-Type: application/json\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}" - lang: Java source: "String data = \"{\\\"memory_export_id\\\":\\\"\\\"}\";\n\nHttpResponse response = Unirest.post(\"https://api.mem0.ai/v1/exports/get/\")\n .header(\"Authorization\", \"Token \")\n .header(\"Content-Type\", \"application/json\")\n .body(data)\n .asString();" components: securitySchemes: ApiKeyAuth: type: apiKey in: header name: Authorization description: 'API key authentication. Prefix your Mem0 API key with ''Token ''. Example: ''Token your_api_key''' x-original-swagger-version: '2.0'