MemorySync
API Reference

Google Drive Configuration

Choose which Drive files and folders a connection reads, using either the Google Picker or explicit resource ids.

Operations on this page

OperationMethod and pathPythonNode.js
Picker configurationGET …/{connection_id}/gdrive/picker-configconnections.gdrive.picker_configconnections.gdrive.pickerConfig
List selected resourcesGET …/{connection_id}/gdrive/resourcesconnections.gdrive.resourcesconnections.gdrive.resources
Select resourcesPOST …/{connection_id}/gdrive/resourcesconnections.gdrive.add_resourcesconnections.gdrive.addResources
Deselect a resourceDELETE …/{connection_id}/gdrive/resources/{resource_id}connections.gdrive.remove_resourceconnections.gdrive.removeResource

Authentication and scope

RequirementContract
CredentialAn API key sent as X-API-Key. Connector operations are not end-user scoped.
Read scopeintegrations:read for every GET.
Write scopeintegrations:write for every POST, PUT, PATCH and DELETE.
TenantDerived from the authenticated key. There is no tenant parameter to pass or to get wrong.
X-End-User-IDNot used. A connection belongs to the organization, not to one end user.

Before you start

You need an active Google Drive connection from the OAuth flow on Providers & OAuth. Drive cannot be connected with an API key.

1. Get the picker configuration

Returns what the browser-side Google Picker needs: the app id, the developer key, and the OAuth token scoped to this connection. Fetching it from your server and handing it to the picker means your page never holds a long-lived Google credential.

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
)
config = client.connections.gdrive.picker_config("conn_8f21a4")
# Serialise this to the browser that renders the picker.
print(config["app_id"], config["client_id"], config["scope"])
GET/api/v2/integrations/connections/{connection_id}/gdrive/picker-config
200 OK
FieldPassed to the Picker as
app_idThe Google Cloud project number.
client_idThe OAuth client id.
api_keyThe browser API key. This is the Picker's developerKey.
oauth_tokenThe access token scoped to this connection.
scopeThe scope the token carries, so the picker can request a matching view.

2. Select files and folders

Selecting a folder selects its contents, and MemorySync keeps following that folder — files added to it later are picked up by later syncs. Selecting a file selects only that file.

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
)
client.connections.gdrive.add_resources(
"conn_8f21a4",
resources=[
{"id": "1AbCdEfGhIjKlMnOpQrStUvWxYz", "type": "folder", "name": "Handbook"},
{"id": "1ZyXwVuTsRqPoNmLkJiHgFeDcBa", "type": "file", "name": "Pricing.pdf"},
],
)
POST/api/v2/integrations/connections/{connection_id}/gdrive/resources
200 OK

3. Read back the selection

Like the Slack channel list, this returns a bare JSON array rather than an object with a resources key.

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
)
for resource in client.connections.gdrive.resources("conn_8f21a4"):
print(resource["resource_id"], resource["resource_type"], resource["name"], resource["permission_state"])
GET/api/v2/integrations/connections/{connection_id}/gdrive/resources
200 OK
FieldMeaning
resource_idDrive's own file or folder id.
resource_typeWhether it is a file or a folder.
name, mime_typeDrive metadata. Both nullable.
web_view_link, icon_urlLinks for showing the item back to a user.
permission_stateWhether the connection can still read it. This is where a revoked share shows up.
is_active, last_synced_atWhether future syncs read it, and when it was last read.

4. Sync and check the formats

Trigger a sync on Sync & Jobs. Google-native documents are exported before parsing; binary formats are parsed as they are. A format with no parser produces an object with no memories rather than an error, which is why an empty result is worth checking rather than assuming a failure.

Drive contentHow it is read
Google DocsExported to text, then extracted.
Google SheetsExported to tabular data; see structured_stats on the object.
Google SlidesExported to text per slide.
PDF, DOCX, PPTX, XLSXParsed directly by the same parsers as file upload.
Images, audio, videoRead only where a transcriber is configured; otherwise no memories.
Shortcuts and shared linksFollowed only if the connection's token can read the target.

5. Deselect a resource

Stops future syncs reading it. Existing objects and memories are kept.

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
)
client.connections.gdrive.remove_resource("conn_8f21a4", "1ZyXwVuTsRqPoNmLkJiHgFeDcBa")
DELETE/api/v2/integrations/connections/{connection_id}/gdrive/resources/{resource_id}
204 No Content

Errors and next action

StatusMeaningNext action
401Missing, malformed or inactive API key.Check server configuration without printing the key.
403The key lacks integrations:read or integrations:write.Grant the scope on the key, or use a key that has it.
404The connection, object or job is not visible to this tenant.Confirm the identifier belongs to this organization.
409The connection is in a state that forbids the operation.Read the connection status first and act on it.
429Rate limited, either by MemorySync or by the upstream provider.Back off; do not tighten a polling loop in response.
5xxService failure.Treat a write outcome as uncertain and reconcile by reading the connection back.