diff --git a/docs/api-reference/organization/add-org-member.mdx b/docs/api-reference/organization/add-org-member.mdx new file mode 100644 index 00000000..53056658 --- /dev/null +++ b/docs/api-reference/organization/add-org-member.mdx @@ -0,0 +1,4 @@ +--- +title: 'Add Member' +openapi: post /api/v1/orgs/organizations/{org_id}/members/ +--- \ No newline at end of file diff --git a/docs/api-reference/organization/create-org.mdx b/docs/api-reference/organization/create-org.mdx new file mode 100644 index 00000000..48f38b4b --- /dev/null +++ b/docs/api-reference/organization/create-org.mdx @@ -0,0 +1,4 @@ +--- +title: 'Create Organization' +openapi: post /api/v1/orgs/organizations/ +--- \ No newline at end of file diff --git a/docs/api-reference/organization/delete-org-member.mdx b/docs/api-reference/organization/delete-org-member.mdx new file mode 100644 index 00000000..4e4c45e4 --- /dev/null +++ b/docs/api-reference/organization/delete-org-member.mdx @@ -0,0 +1,4 @@ +--- +title: 'Delete Member' +openapi: delete /api/v1/orgs/organizations/{org_id}/members/ +--- \ No newline at end of file diff --git a/docs/api-reference/organization/delete-org.mdx b/docs/api-reference/organization/delete-org.mdx new file mode 100644 index 00000000..bcc0c3d1 --- /dev/null +++ b/docs/api-reference/organization/delete-org.mdx @@ -0,0 +1,4 @@ +--- +title: 'Delete Organization' +openapi: delete /api/v1/orgs/organizations/{org_id}/ +--- \ No newline at end of file diff --git a/docs/api-reference/organization/get-org-members.mdx b/docs/api-reference/organization/get-org-members.mdx new file mode 100644 index 00000000..003f0934 --- /dev/null +++ b/docs/api-reference/organization/get-org-members.mdx @@ -0,0 +1,4 @@ +--- +title: 'Get Members' +openapi: get /api/v1/orgs/organizations/{org_id}/members/ +--- \ No newline at end of file diff --git a/docs/api-reference/organization/get-org.mdx b/docs/api-reference/organization/get-org.mdx new file mode 100644 index 00000000..23231236 --- /dev/null +++ b/docs/api-reference/organization/get-org.mdx @@ -0,0 +1,4 @@ +--- +title: 'Get Organization' +openapi: get /api/v1/orgs/organizations/{org_id}/ +--- \ No newline at end of file diff --git a/docs/api-reference/organization/get-orgs.mdx b/docs/api-reference/organization/get-orgs.mdx new file mode 100644 index 00000000..ddb6594f --- /dev/null +++ b/docs/api-reference/organization/get-orgs.mdx @@ -0,0 +1,4 @@ +--- +title: 'Get Organizations' +openapi: get /api/v1/orgs/organizations/ +--- \ No newline at end of file diff --git a/docs/api-reference/organization/update-org-member.mdx b/docs/api-reference/organization/update-org-member.mdx new file mode 100644 index 00000000..126787fa --- /dev/null +++ b/docs/api-reference/organization/update-org-member.mdx @@ -0,0 +1,4 @@ +--- +title: 'Update Member' +openapi: put /api/v1/orgs/organizations/{org_id}/members/ +--- \ No newline at end of file diff --git a/docs/api-reference/overview.mdx b/docs/api-reference/overview.mdx index 44305f71..99b393fc 100644 --- a/docs/api-reference/overview.mdx +++ b/docs/api-reference/overview.mdx @@ -23,6 +23,32 @@ Our API is organized into several main categories: All API requests require authentication using HTTP Basic Auth. Ensure you include your API key in the Authorization header of each request. +## Organizations and projects (optional) + +For users who belong to multiple organizations or are working on multiple projects, you can specify the organization and project for an API request. This is done by initializing the Mem0 client with the appropriate parameters. Usage from these API requests will be attributed to the specified organization and project. + +Example with the mem0 Python package: + +```python +from mem0 import MemoryClient + +client = MemoryClient( + organization_name='YOUR_ORG_NAME', + project_name='YOUR_PROJECT_NAME', +) +``` + +Example with the mem0 Node.js package: + +```javascript +import { MemoryClient } from "mem0ai"; + +const client = new MemoryClient({ + organization: "YOUR_ORG_NAME", + project: "YOUR_PROJECT_NAME" +}); +``` + ## Getting Started To begin using the Mem0 API, you'll need to: diff --git a/docs/api-reference/project/add-project-member.mdx b/docs/api-reference/project/add-project-member.mdx new file mode 100644 index 00000000..721fd45f --- /dev/null +++ b/docs/api-reference/project/add-project-member.mdx @@ -0,0 +1,4 @@ +--- +title: 'Add Member' +openapi: post /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ +--- \ No newline at end of file diff --git a/docs/api-reference/project/create-project.mdx b/docs/api-reference/project/create-project.mdx new file mode 100644 index 00000000..24f18f55 --- /dev/null +++ b/docs/api-reference/project/create-project.mdx @@ -0,0 +1,4 @@ +--- +title: 'Create Project' +openapi: post /api/v1/orgs/organizations/{org_id}/projects/ +--- \ No newline at end of file diff --git a/docs/api-reference/project/delete-project-member.mdx b/docs/api-reference/project/delete-project-member.mdx new file mode 100644 index 00000000..3099cae7 --- /dev/null +++ b/docs/api-reference/project/delete-project-member.mdx @@ -0,0 +1,4 @@ +--- +title: 'Delete Member' +openapi: delete /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ +--- \ No newline at end of file diff --git a/docs/api-reference/project/delete-project.mdx b/docs/api-reference/project/delete-project.mdx new file mode 100644 index 00000000..96fb20da --- /dev/null +++ b/docs/api-reference/project/delete-project.mdx @@ -0,0 +1,4 @@ +--- +title: 'Delete Project' +openapi: delete /api/v1/orgs/organizations/{org_id}/projects/{project_id}/ +--- \ No newline at end of file diff --git a/docs/api-reference/project/get-project-members.mdx b/docs/api-reference/project/get-project-members.mdx new file mode 100644 index 00000000..42171dce --- /dev/null +++ b/docs/api-reference/project/get-project-members.mdx @@ -0,0 +1,4 @@ +--- +title: 'Get Members' +openapi: get /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ +--- \ No newline at end of file diff --git a/docs/api-reference/project/get-project.mdx b/docs/api-reference/project/get-project.mdx new file mode 100644 index 00000000..219f2a21 --- /dev/null +++ b/docs/api-reference/project/get-project.mdx @@ -0,0 +1,4 @@ +--- +title: 'Get Project' +openapi: get /api/v1/orgs/organizations/{org_id}/projects/{project_id}/ +--- \ No newline at end of file diff --git a/docs/api-reference/project/get-projects.mdx b/docs/api-reference/project/get-projects.mdx new file mode 100644 index 00000000..f484adf4 --- /dev/null +++ b/docs/api-reference/project/get-projects.mdx @@ -0,0 +1,4 @@ +--- +title: 'Get Projects' +openapi: get /api/v1/orgs/organizations/{org_id}/projects/ +--- \ No newline at end of file diff --git a/docs/api-reference/project/update-project-member.mdx b/docs/api-reference/project/update-project-member.mdx new file mode 100644 index 00000000..de438d92 --- /dev/null +++ b/docs/api-reference/project/update-project-member.mdx @@ -0,0 +1,4 @@ +--- +title: 'Update Member' +openapi: put /api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/ +--- \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index a21c0cca..023c4074 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -159,6 +159,42 @@ "api-reference/entities/get-users", "api-reference/entities/delete-user" ] + }, + { + "group": "Organizations APIs", + "pages": [ + "api-reference/organization/get-orgs", + "api-reference/organization/get-org", + "api-reference/organization/create-org", + "api-reference/organization/delete-org", + { + "group": "Members APIs", + "pages": [ + "api-reference/organization/get-org-members", + "api-reference/organization/add-org-member", + "api-reference/organization/update-org-member", + "api-reference/organization/delete-org-member" + ] + } + ] + }, + { + "group": "Projects APIs", + "pages": [ + "api-reference/project/get-projects", + "api-reference/project/get-project", + "api-reference/project/create-project", + "api-reference/project/delete-project", + { + "group": "Members APIs", + "pages":[ + "api-reference/project/get-project-members", + "api-reference/project/add-project-member", + "api-reference/project/update-project-member", + "api-reference/project/delete-project-member" + ] + } + ] } ] }, diff --git a/docs/openapi.json b/docs/openapi.json index 038cf3da..7f51dec0 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -1203,6 +1203,1010 @@ }, "x-codegen-request-body-name": "data" } + }, + "/api/v1/orgs/organizations/": { + "get": { + "tags": [ + "organizations" + ], + "operationId": "organizations_read", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Unique identifier for the organization" + }, + "org_id": { + "type": "string", + "description": "Organization's unique string identifier" + }, + "name": { + "type": "string", + "description": "Name of the organization" + }, + "description": { + "type": "string", + "description": "Brief description of the organization" + }, + "address": { + "type": "string", + "description": "Physical address of the organization" + }, + "contact_email": { + "type": "string", + "description": "Primary contact email for the organization" + }, + "phone_number": { + "type": "string", + "description": "Contact phone number for the organization" + }, + "website": { + "type": "string", + "description": "Official website URL of the organization" + }, + "on_paid_plan": { + "type": "boolean", + "description": "Indicates whether the organization is on a paid plan" + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the organization was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the organization was last updated" + }, + "owner": { + "type": "integer", + "description": "Identifier of the organization's owner" + }, + "members": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "List of member identifiers belonging to the organization" + } + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "organizations" + ], + "description": "Create a new organization.", + "operationId": "create_organization", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the new organization" + } + }, + "required": ["name"] + } + } + } + }, + "responses": { + "201": { + "description": "Successfully created a new organization", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "Organization created successfully." + } + } + } + } + } + } + } + } + }, + "/api/v1/orgs/organizations/{org_id}/": { + "get": { + "tags": [ + "organizations" + ], + "description": "Get a organization.", + "operationId": "get_organization", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "The unique identifier of the organization", + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Unique identifier for the organization" + }, + "org_id": { + "type": "string", + "description": "Unique organization ID" + }, + "name": { + "type": "string", + "description": "Name of the organization" + }, + "description": { + "type": "string", + "description": "Description of the organization" + }, + "address": { + "type": "string", + "description": "Address of the organization" + }, + "contact_email": { + "type": "string", + "format": "email", + "description": "Contact email for the organization" + }, + "phone_number": { + "type": "string", + "description": "Phone number of the organization" + }, + "website": { + "type": "string", + "format": "uri", + "description": "Website of the organization" + }, + "on_paid_plan": { + "type": "boolean", + "description": "Indicates if the organization is on a paid plan" + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the organization was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the organization was last updated" + }, + "owner": { + "type": "integer", + "description": "Identifier of the organization's owner" + }, + "members": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "List of member identifiers belonging to the organization" + } + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "organizations" + ], + "summary": "Delete an organization", + "description": "Delete an organization by its ID.", + "operationId": "delete_organization", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization to delete", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Organization deleted successfully!", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "Organization deleted successfully!" + } + } + } + } + } + } + } + } + }, + "/api/v1/orgs/organizations/{org_id}/members/": { + "get": { + "tags": [ + "organizations" + ], + "summary": "Get organization members", + "description": "Retrieve a list of members for a specific organization.", + "operationId": "get_organization_members", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "members": { + "type": "array", + "items": { + "type": "object", + "properties": { + "user_id": { + "type": "string", + "description": "Unique identifier of the member" + }, + "role": { + "type": "string", + "description": "Role of the member in the organization" + } + } + }, + "description": "List of members belonging to the organization" + } + } + } + } + } + } + } + }, + "put": { + "tags": [ + "organizations" + ], + "summary": "Update organization member role", + "description": "Update the role of an existing member in a specific organization.", + "operationId": "update_organization_member_role", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "username", + "role" + ], + "properties": { + "username": { + "type": "string", + "description": "Username of the member whose role is to be updated" + }, + "role": { + "type": "string", + "description": "New role of the member in the organization" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "User role updated successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "User role updated successfully" + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "organizations" + ], + "summary": "Add organization member", + "description": "Add a new member to a specific organization.", + "operationId": "add_organization_member", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "username", + "role" + ], + "properties": { + "username": { + "type": "string", + "description": "Username of the member to be added" + }, + "role": { + "type": "string", + "description": "Role of the member in the organization" + } + } + } + } + } + }, + "responses": { + "201": { + "description": "Member added successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "User added to the organization." + } + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "organizations" + ], + "summary": "Remove a member from the organization", + "operationId": "remove_organization_member", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "username" + ], + "properties": { + "username": { + "type": "string", + "description": "Username of the member to be removed" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Member removed successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "User removed from organization." + } + } + } + } + } + } + } + } + }, + "/api/v1/orgs/organizations/{org_id}/projects/": { + "get": { + "tags": [ + "projects" + ], + "summary": "Get projects", + "description": "Retrieve a list of projects for a specific organization.", + "operationId": "get_projects", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Unique numeric identifier of the project" + }, + "project_id": { + "type": "string", + "description": "Unique string identifier of the project" + }, + "name": { + "type": "string", + "description": "Name of the project" + }, + "description": { + "type": "string", + "description": "Description of the project" + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the project was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the project was last updated" + }, + "members": { + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "Username of the project member" + }, + "role": { + "type": "string", + "description": "Role of the member in the project" + } + } + }, + "description": "List of members belonging to the project" + } + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "projects" + ], + "summary": "Create project", + "description": "Create a new project within an organization.", + "operationId": "create_project", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the project to be created" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Project created successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "Project created successfully." + } + } + } + } + } + } + } + } + }, + "/api/v1/orgs/organizations/{org_id}/projects/{project_id}/": { + "get": { + "tags": [ + "projects" + ], + "summary": "Get project details", + "description": "Retrieve details of a specific project within an organization.", + "operationId": "get_project", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + }, + { + "name": "project_id", + "in": "path", + "required": true, + "description": "Unique identifier of the project", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Unique numeric identifier of the project" + }, + "project_id": { + "type": "string", + "description": "Unique string identifier of the project" + }, + "name": { + "type": "string", + "description": "Name of the project" + }, + "description": { + "type": "string", + "description": "Description of the project" + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the project was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the project was last updated" + }, + "members": { + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "Username of the project member" + }, + "role": { + "type": "string", + "description": "Role of the member in the project" + } + } + }, + "description": "List of members belonging to the project" + } + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "projects" + ], + "summary": "Delete Project", + "description": "Delete a specific project and its related data.", + "operationId": "delete_project", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + }, + { + "name": "project_id", + "in": "path", + "required": true, + "description": "Unique identifier of the project to be deleted", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Project and related data deleted successfully.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "Project and related data deleted successfully." + } + } + } + } + } + } + } + } + }, + "/api/v1/orgs/organizations/{org_id}/projects/{project_id}/members/": { + "get": { + "tags": [ + "projects" + ], + "summary": "Get Project Members", + "description": "Retrieve a list of members for a specific project.", + "operationId": "get_project_members", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + }, + { + "name": "project_id", + "in": "path", + "required": true, + "description": "Unique identifier of the project", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully retrieved project members", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "members": { + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "role": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "projects" + ], + "summary": "Add member to project", + "description": "Add a new member to a specific project within an organization.", + "operationId": "add_project_member", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + }, + { + "name": "project_id", + "in": "path", + "required": true, + "description": "Unique identifier of the project", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "username", + "role" + ], + "properties": { + "username": { + "type": "string", + "description": "Username of the member to be added" + }, + "role": { + "type": "string", + "description": "Role of the member in the project" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "User added to the project successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "User added to the project successfully." + } + } + } + } + } + } + } + }, + "put": { + "tags": [ + "projects" + ], + "summary": "Update project member role", + "description": "Update the role of a member in a specific project within an organization.", + "operationId": "update_project_member", + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + }, + { + "name": "project_id", + "in": "path", + "required": true, + "description": "Unique identifier of the project", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "username", + "role" + ], + "properties": { + "username": { + "type": "string", + "description": "Username of the member to be updated" + }, + "role": { + "type": "string", + "description": "New role of the member in the project" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "User role updated successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "User role updated successfully." + } + } + } + } + } + } + } + }, + "delete": { + "summary": "Delete Project Member", + "operationId": "deleteProjectMember", + "tags": ["Project"], + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "description": "Unique identifier of the organization", + "schema": { + "type": "string" + } + }, + { + "name": "project_id", + "in": "path", + "required": true, + "description": "Unique identifier of the project", + "schema": { + "type": "string" + } + }, + { + "name": "username", + "in": "query", + "required": true, + "description": "Username of the member to be removed", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Member removed from the project successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "Member removed from the project" + } + } + } + } + } + } + } + } } }, "components": {