API Reference
OneDrive Configuration
Connect OneDrive through Microsoft OAuth, confirm the account, and synchronize accessible OneDrive files and SharePoint document libraries. Source permissions define what the connector can discover.
Operations on this page
| Operation | Method and path | Python | Node.js |
|---|---|---|---|
| Read OneDrive capabilities | GET /api/v2/integrations/providers/onedrive | providers.get | providers.get |
| Start Microsoft OAuth | POST /api/v2/integrations/oauth/initiate | connections.oauth.initiate | connections.oauth.initiate |
| Confirm the connection | GET /api/v2/integrations/connections/{connection_id} | connections.get | connections.get |
| Start synchronization | POST /api/v2/integrations/connections/{connection_id}/sync | connections.trigger_sync | connections.triggerSync |
Authentication and scope
| Requirement | Contract |
|---|---|
| Credential | An API key sent as X-API-Key. Connector operations are not end-user scoped. |
| Read scope | integrations:read for every GET. |
| Write scope | integrations:write for every POST, PUT, PATCH and DELETE. |
| Tenant | Derived from the authenticated key. There is no tenant parameter to pass or to get wrong. |
X-End-User-ID | Not used. A connection belongs to the organization, not to one end user. |
1. Check OneDrive availability
Read the provider record before setup. The provider id is onedrive, even when your product labels the consent button Microsoft 365.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)provider = client.providers.get("onedrive")print(provider["is_available"], provider["capabilities"])
GET/api/v2/integrations/providers/{provider_id}
200 OK
2. Authorize Microsoft access
Start OAuth and redirect the browser to the returned URL. The connected Microsoft account and granted scopes determine which drives and libraries can be discovered.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)result = client.connections.oauth.initiate("onedrive",redirect_url="https://app.example.com/connections/callback",)print(result["authorization_url"], result["connection_id"])
POST/api/v2/integrations/oauth/initiate
200 OK
3. Confirm and sync
Confirm the connection before starting an incremental sync. Use the job response to follow progress instead of waiting on this request.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)connection = client.connections.get("conn_8f21a4")if connection["status"] == "connected":job = client.connections.trigger_sync("conn_8f21a4", job_type="incremental")print(job["id"], job["status"])
GET/api/v2/integrations/connections/{connection_id}
200 OK
POST/api/v2/integrations/connections/{connection_id}/sync
202 Accepted
Errors and next action
| Status | Meaning | Next action |
|---|---|---|
401 | Missing, malformed or inactive API key. | Check server configuration without printing the key. |
403 | The key lacks integrations:read or integrations:write. | Grant the scope on the key, or use a key that has it. |
404 | The connection, object or job is not visible to this tenant. | Confirm the identifier belongs to this organization. |
409 | The connection is in a state that forbids the operation. | Read the connection status first and act on it. |
429 | Rate limited, either by MemorySync or by the upstream provider. | Back off; do not tighten a polling loop in response. |
5xx | Service failure. | Treat a write outcome as uncertain and reconcile by reading the connection back. |