From ece654811ab925df9846d4d75ebd9eaaa5962025 Mon Sep 17 00:00:00 2001 From: Agam Pandey Date: Sat, 28 Mar 2026 20:38:42 +0530 Subject: [PATCH] fix(docs): add Token prefix to Events API code examples (#3927) --- docs/api-reference/events/get-events.mdx | 3 +- docs/api-reference/memory/add-memories.mdx | 4 ++ docs/openapi.json | 56 +++++++++++++++++++++- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/docs/api-reference/events/get-events.mdx b/docs/api-reference/events/get-events.mdx index 33cbc15b4..695e46bd2 100644 --- a/docs/api-reference/events/get-events.mdx +++ b/docs/api-reference/events/get-events.mdx @@ -10,5 +10,4 @@ List recent events for your organization and project. - **Dashboards**: Summarize adds/searches over time by paging through events. - **Alerting**: Poll for `FAILED` events and trigger follow-up workflows. -- **Audit**: Store the returned payload/metadata for compliance logs. - +- **Audit**: Store the returned payload/metadata for compliance logs. \ No newline at end of file diff --git a/docs/api-reference/memory/add-memories.mdx b/docs/api-reference/memory/add-memories.mdx index 026afe775..144ce1217 100644 --- a/docs/api-reference/memory/add-memories.mdx +++ b/docs/api-reference/memory/add-memories.mdx @@ -52,6 +52,10 @@ Provide at least one message or direct memory string. Most callers supply `messa > \* Provide at least one `messages` entry to describe what you are storing. For scoped memories, include `user_id`. You can also attach `agent_id`, `app_id`, `run_id`, `project_id`, or `org_id` to refine ownership. + + Need more details? See [all request parameters](#body-messages) below for complete field descriptions, types, and constraints. + + ## Response Successful requests return an array of events queued for processing. Each event includes the generated memory text and an identifier you can persist for auditing. diff --git a/docs/openapi.json b/docs/openapi.json index e35e73357..f7aff39d5 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -457,7 +457,33 @@ } } } - } + }, + "x-code-samples": [ + { + "lang": "Python", + "source": "import requests\n\nurl = \"https://api.mem0.ai/v1/events/\"\n\nheaders = {\"Authorization\": \"Token \"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)" + }, + { + "lang": "JavaScript", + "source": "const options = {method: 'GET', headers: {Authorization: 'Token '}};\n\nfetch('https://api.mem0.ai/v1/events/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));" + }, + { + "lang": "cURL", + "source": "curl --request GET \\\n --url https://api.mem0.ai/v1/events/ \\\n --header 'Authorization: Token '" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/events/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, 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(res)\n\tfmt.Println(string(body))\n\n}" + }, + { + "lang": "PHP", + "source": " \"https://api.mem0.ai/v1/events/\",\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 => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token \"\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": "HttpResponse response = Unirest.get(\"https://api.mem0.ai/v1/events/\")\n .header(\"Authorization\", \"Token \")\n .asString();" + } + ] } }, "/v1/event/{event_id}/": { @@ -563,7 +589,33 @@ } } } - } + }, + "x-code-samples": [ + { + "lang": "Python", + "source": "import requests\n\nurl = \"https://api.mem0.ai/v1/event/{event_id}/\"\n\nheaders = {\"Authorization\": \"Token \"}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)" + }, + { + "lang": "JavaScript", + "source": "const options = {method: 'GET', headers: {Authorization: 'Token '}};\n\nfetch('https://api.mem0.ai/v1/event/{event_id}/', options)\n .then(response => response.json())\n .then(response => console.log(response))\n .catch(err => console.error(err));" + }, + { + "lang": "cURL", + "source": "curl --request GET \\\n --url https://api.mem0.ai/v1/event/{event_id}/ \\\n --header 'Authorization: Token '" + }, + { + "lang": "Go", + "source": "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https://api.mem0.ai/v1/event/{event_id}/\"\n\n\treq, _ := http.NewRequest(\"GET\", url, 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(res)\n\tfmt.Println(string(body))\n\n}" + }, + { + "lang": "PHP", + "source": " \"https://api.mem0.ai/v1/event/{event_id}/\",\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 => \"GET\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Token \"\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": "HttpResponse response = Unirest.get(\"https://api.mem0.ai/v1/event/{event_id}/\")\n .header(\"Authorization\", \"Token \")\n .asString();" + } + ] } }, "/v1/exports/": {