fix(docs): Correct API authentication header from Bearer to Token (#3820)
This commit is contained in:
@@ -17,7 +17,7 @@ Memories are processed asynchronously by default. The response contains queued e
|
|||||||
|
|
||||||
| Header | Required | Description |
|
| Header | Required | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `Authorization: Bearer <MEM0_API_KEY>` | Yes | API key scoped to your workspace. |
|
| `Authorization: Token <MEM0_API_KEY>` | Yes | API key scoped to your workspace. |
|
||||||
| `Accept: application/json` | Yes | Ensures a JSON response. |
|
| `Accept: application/json` | Yes | Ensures a JSON response. |
|
||||||
|
|
||||||
## Request body
|
## Request body
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ await client.add(messages, { user_id: "user123" });
|
|||||||
|
|
||||||
```bash cURL
|
```bash cURL
|
||||||
curl -X POST https://api.mem0.ai/v1/memories/add \
|
curl -X POST https://api.mem0.ai/v1/memories/add \
|
||||||
-H "Authorization: Bearer $MEM0_API_KEY" \
|
-H "Authorization: Token $MEM0_API_KEY" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"messages": [
|
"messages": [
|
||||||
@@ -97,7 +97,7 @@ console.log(results);
|
|||||||
|
|
||||||
```bash cURL
|
```bash cURL
|
||||||
curl -X POST https://api.mem0.ai/v1/memories/search \
|
curl -X POST https://api.mem0.ai/v1/memories/search \
|
||||||
-H "Authorization: Bearer $MEM0_API_KEY" \
|
-H "Authorization: Token $MEM0_API_KEY" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"query": "What are my dietary restrictions?",
|
"query": "What are my dietary restrictions?",
|
||||||
|
|||||||
+5
-5
@@ -35,7 +35,7 @@ path: "/v1/memories"
|
|||||||
|
|
||||||
| Method | Path | Auth | Rate Limit |
|
| Method | Path | Auth | Rate Limit |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| [METHOD] | `[path]` | Bearer (`mem0-api-key`) | [X req/min] |
|
| [METHOD] | `[path]` | Token (`mem0-api-key`) | [X req/min] |
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Use this endpoint when [brief scenario]. Prefer [alternative endpoint] for [other scenario].
|
Use this endpoint when [brief scenario]. Prefer [alternative endpoint] for [other scenario].
|
||||||
@@ -51,7 +51,7 @@ path: "/v1/memories"
|
|||||||
|
|
||||||
| Name | Required | Description |
|
| Name | Required | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `Authorization` | Yes | `Bearer YOUR_API_KEY` |
|
| `Authorization` | Yes | `Token YOUR_API_KEY` |
|
||||||
| `Content-Type` | Yes | `application/json` |
|
| `Content-Type` | Yes | `application/json` |
|
||||||
|
|
||||||
### Body
|
### Body
|
||||||
@@ -65,7 +65,7 @@ path: "/v1/memories"
|
|||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
```bash Shell
|
```bash Shell
|
||||||
curl https://api.mem0.ai/v1/memories \
|
curl https://api.mem0.ai/v1/memories \
|
||||||
-H "Authorization: Bearer $MEM0_API_KEY" \
|
-H "Authorization: Token $MEM0_API_KEY" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{ "user_id": "alex", "memory": "Prefers email follow-ups." }'
|
-d '{ "user_id": "alex", "memory": "Prefers email follow-ups." }'
|
||||||
```
|
```
|
||||||
@@ -75,7 +75,7 @@ import requests
|
|||||||
|
|
||||||
resp = requests.post(
|
resp = requests.post(
|
||||||
"https://api.mem0.ai/v1/memories",
|
"https://api.mem0.ai/v1/memories",
|
||||||
headers={"Authorization": f"Bearer {API_KEY}"},
|
headers={"Authorization": f"Token {API_KEY}"},
|
||||||
json={"user_id": "alex", "memory": "Prefers email follow-ups."},
|
json={"user_id": "alex", "memory": "Prefers email follow-ups."},
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
@@ -85,7 +85,7 @@ resp.raise_for_status()
|
|||||||
const response = await fetch("https://api.mem0.ai/v1/memories", {
|
const response = await fetch("https://api.mem0.ai/v1/memories", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${process.env.MEM0_API_KEY}`,
|
Authorization: `Token ${process.env.MEM0_API_KEY}`,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ user_id: "alex", memory: "Prefers email follow-ups." }),
|
body: JSON.stringify({ user_id: "alex", memory: "Prefers email follow-ups." }),
|
||||||
|
|||||||
Reference in New Issue
Block a user