# Connections ## Create connection `connections.create(Literal["notion", "google-drive", "onedrive", 4 more]provider, ConnectionCreateParams**kwargs) -> ConnectionCreateResponse` **post** `/v3/connections/{provider}` Initialize connection and get authorization URL ### Parameters - `provider: Literal["notion", "google-drive", "onedrive", 4 more]` - `"notion"` - `"google-drive"` - `"onedrive"` - `"gmail"` - `"github"` - `"web-crawler"` - `"s3"` - `container_tag: Optional[str]` - `container_tags: Optional[Sequence[str]]` - `document_limit: Optional[int]` - `metadata: Optional[Dict[str, Union[str, float, bool]]]` - `str` - `float` - `bool` - `redirect_url: Optional[str]` ### Returns - `class ConnectionCreateResponse: …` - `id: str` - `auth_link: str` - `expires_in: str` - `redirects_to: Optional[str]` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) connection = client.connections.create( provider="notion", ) print(connection.id) ``` #### Response ```json { "id": "id", "authLink": "authLink", "expiresIn": "expiresIn", "redirectsTo": "redirectsTo" } ``` ## Get connection (by id) `connections.get_by_id(strconnection_id) -> ConnectionGetByIDResponse` **get** `/v3/connections/{connectionId}` Get connection details with id ### Parameters - `connection_id: str` ### Returns - `class ConnectionGetByIDResponse: …` - `id: str` - `created_at: str` - `provider: str` - `container_tags: Optional[List[str]]` - `document_limit: Optional[float]` - `email: Optional[str]` - `expires_at: Optional[str]` - `metadata: Optional[Dict[str, object]]` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.get_by_id( "connectionId", ) print(response.id) ``` #### Response ```json { "id": "id", "createdAt": "createdAt", "provider": "provider", "containerTags": [ "string" ], "documentLimit": 0, "email": "email", "expiresAt": "expiresAt", "metadata": { "foo": "bar" } } ``` ## Get connection (by provider) `connections.get_by_tag(Literal["notion", "google-drive", "onedrive", 4 more]provider, ConnectionGetByTagParams**kwargs) -> ConnectionGetByTagResponse` **post** `/v3/connections/{provider}/connection` Get connection details with provider and container tags ### Parameters - `provider: Literal["notion", "google-drive", "onedrive", 4 more]` - `"notion"` - `"google-drive"` - `"onedrive"` - `"gmail"` - `"github"` - `"web-crawler"` - `"s3"` - `container_tags: Sequence[str]` Comma-separated list of container tags to filter connection by ### Returns - `class ConnectionGetByTagResponse: …` - `id: str` - `created_at: str` - `provider: str` - `container_tags: Optional[List[str]]` - `document_limit: Optional[float]` - `email: Optional[str]` - `expires_at: Optional[str]` - `metadata: Optional[Dict[str, object]]` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.get_by_tag( provider="notion", container_tags=["user_123", "project_123"], ) print(response.id) ``` #### Response ```json { "id": "id", "createdAt": "createdAt", "provider": "provider", "containerTags": [ "string" ], "documentLimit": 0, "email": "email", "expiresAt": "expiresAt", "metadata": { "foo": "bar" } } ``` ## Delete connection by ID `connections.delete_by_id(strconnection_id, ConnectionDeleteByIDParams**kwargs) -> ConnectionDeleteByIDResponse` **delete** `/v3/connections/{connectionId}` Delete a specific connection by ID ### Parameters - `connection_id: str` - `delete_documents: Optional[str]` Whether to also delete documents imported by this connection. Defaults to true. ### Returns - `class ConnectionDeleteByIDResponse: …` - `id: str` - `provider: str` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.delete_by_id( connection_id="connectionId", ) print(response.id) ``` #### Response ```json { "id": "id", "provider": "provider" } ``` ## Delete connection `connections.delete_by_provider(Literal["notion", "google-drive", "onedrive", 4 more]provider, ConnectionDeleteByProviderParams**kwargs) -> ConnectionDeleteByProviderResponse` **delete** `/v3/connections/{provider}` Delete connection for a specific provider and container tags ### Parameters - `provider: Literal["notion", "google-drive", "onedrive", 4 more]` - `"notion"` - `"google-drive"` - `"onedrive"` - `"gmail"` - `"github"` - `"web-crawler"` - `"s3"` - `container_tags: Sequence[str]` Optional comma-separated list of container tags to filter connections by ### Returns - `class ConnectionDeleteByProviderResponse: …` - `id: str` - `provider: str` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.delete_by_provider( provider="notion", container_tags=["user_123", "project_123"], ) print(response.id) ``` #### Response ```json { "id": "id", "provider": "provider" } ``` ## Sync connection `connections.import_(Literal["notion", "google-drive", "onedrive", 4 more]provider, ConnectionImportParams**kwargs) -> ConnectionImportResponse` **post** `/v3/connections/{provider}/import` Initiate a manual sync of connections ### Parameters - `provider: Literal["notion", "google-drive", "onedrive", 4 more]` - `"notion"` - `"google-drive"` - `"onedrive"` - `"gmail"` - `"github"` - `"web-crawler"` - `"s3"` - `container_tags: Optional[Sequence[str]]` Optional comma-separated list of container tags to filter connections by ### Returns - `str` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.import_( provider="notion", ) print(response) ``` ## List connections `connections.list(ConnectionListParams**kwargs) -> ConnectionListResponse` **post** `/v3/connections/list` List all connections ### Parameters - `container_tags: Optional[Sequence[str]]` Optional comma-separated list of container tags to filter documents by ### Returns - `List[ConnectionListResponseItem]` - `id: str` - `created_at: str` - `provider: str` - `container_tags: Optional[List[str]]` - `document_limit: Optional[float]` - `email: Optional[str]` - `expires_at: Optional[str]` - `metadata: Optional[Dict[str, object]]` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) connections = client.connections.list() print(connections) ``` #### Response ```json [ { "id": "id", "createdAt": "createdAt", "provider": "provider", "containerTags": [ "string" ], "documentLimit": 0, "email": "email", "expiresAt": "expiresAt", "metadata": { "foo": "bar" } } ] ``` ## List documents `connections.list_documents(Literal["notion", "google-drive", "onedrive", 4 more]provider, ConnectionListDocumentsParams**kwargs) -> ConnectionListDocumentsResponse` **post** `/v3/connections/{provider}/documents` List documents indexed for a provider and container tags ### Parameters - `provider: Literal["notion", "google-drive", "onedrive", 4 more]` - `"notion"` - `"google-drive"` - `"onedrive"` - `"gmail"` - `"github"` - `"web-crawler"` - `"s3"` - `container_tags: Optional[Sequence[str]]` Optional comma-separated list of container tags to filter documents by ### Returns - `List[ConnectionListDocumentsResponseItem]` - `id: str` - `created_at: str` - `status: str` - `summary: Optional[str]` - `title: Optional[str]` - `type: str` - `updated_at: str` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.list_documents( provider="notion", ) print(response) ``` #### Response ```json [ { "id": "id", "createdAt": "createdAt", "status": "status", "summary": "summary", "title": "title", "type": "type", "updatedAt": "updatedAt" } ] ``` ## Configure connection `connections.configure(strconnection_id, ConnectionConfigureParams**kwargs) -> ConnectionConfigureResponse` **post** `/v3/connections/{connectionId}/configure` Configure resources for a connection (supported providers: GitHub for now) ### Parameters - `connection_id: str` - `resources: Iterable[Dict[str, object]]` ### Returns - `class ConnectionConfigureResponse: …` - `message: str` - `success: bool` - `webhooks_registered: Optional[float]` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.configure( connection_id="connectionId", resources=[{ "foo": "bar" }], ) print(response.message) ``` #### Response ```json { "message": "message", "success": true, "webhooksRegistered": 0 } ``` ## Fetch resources `connections.resources(strconnection_id, ConnectionResourcesParams**kwargs) -> ConnectionResourcesResponse` **get** `/v3/connections/{connectionId}/resources` Fetch resources for a connection (supported providers: GitHub for now) ### Parameters - `connection_id: str` - `page: Optional[float]` - `parent_id: Optional[str]` - `per_page: Optional[float]` ### Returns - `class ConnectionResourcesResponse: …` - `resources: List[Dict[str, object]]` - `total_count: Optional[float]` ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.connections.resources( connection_id="connectionId", ) print(response.resources) ``` #### Response ```json { "resources": [ { "foo": "bar" } ], "total_count": 0 } ``` ## Domain Types ### Connection Create Response - `class ConnectionCreateResponse: …` - `id: str` - `auth_link: str` - `expires_in: str` - `redirects_to: Optional[str]` ### Connection Get By ID Response - `class ConnectionGetByIDResponse: …` - `id: str` - `created_at: str` - `provider: str` - `container_tags: Optional[List[str]]` - `document_limit: Optional[float]` - `email: Optional[str]` - `expires_at: Optional[str]` - `metadata: Optional[Dict[str, object]]` ### Connection Get By Tag Response - `class ConnectionGetByTagResponse: …` - `id: str` - `created_at: str` - `provider: str` - `container_tags: Optional[List[str]]` - `document_limit: Optional[float]` - `email: Optional[str]` - `expires_at: Optional[str]` - `metadata: Optional[Dict[str, object]]` ### Connection Delete By ID Response - `class ConnectionDeleteByIDResponse: …` - `id: str` - `provider: str` ### Connection Delete By Provider Response - `class ConnectionDeleteByProviderResponse: …` - `id: str` - `provider: str` ### Connection Import Response - `str` ### Connection List Response - `List[ConnectionListResponseItem]` - `id: str` - `created_at: str` - `provider: str` - `container_tags: Optional[List[str]]` - `document_limit: Optional[float]` - `email: Optional[str]` - `expires_at: Optional[str]` - `metadata: Optional[Dict[str, object]]` ### Connection List Documents Response - `List[ConnectionListDocumentsResponseItem]` - `id: str` - `created_at: str` - `status: str` - `summary: Optional[str]` - `title: Optional[str]` - `type: str` - `updated_at: str` ### Connection Configure Response - `class ConnectionConfigureResponse: …` - `message: str` - `success: bool` - `webhooks_registered: Optional[float]` ### Connection Resources Response - `class ConnectionResourcesResponse: …` - `resources: List[Dict[str, object]]` - `total_count: Optional[float]`