Connectors — Google Drive & SharePoint¶
Connectors let you import documents from cloud storage providers directly into your knowledge base.
Overview¶
Ag2Trust supports two connector types:
| Provider | Auth Method | Features |
|---|---|---|
| Google Drive | OAuth 2.0 | Folder selection, automatic sync |
| SharePoint | OAuth 2.0 | Drive + folder selection, automatic sync |
Once connected, documents are imported, processed, and made available to agents as knowledge documents.
Setting Up a Connector¶
Via Dashboard¶
- Go to Knowledge Base > Connectors
- Click Add Connector
- Select your provider (Google Drive or SharePoint)
- Complete the OAuth authorization flow
- Select a folder to import from
- Click Import
Via API (SharePoint Example)¶
Step 1: Initiate OAuth¶
The OAuth flow is initiated via the dashboard. After authorization, the connector appears in the API.
Step 2: List Connectors¶
Response:
[
{
"id": 1,
"provider": "sharepoint",
"status": "connected",
"folder_name": "Engineering Docs",
"created_at": "2025-01-15T10:00:00Z"
}
]
Step 3: Browse and Select a Drive (SharePoint)¶
# List available drives
curl https://api.ag2trust.com/api/v1/connectors/1/drives \
-H "X-API-Key: cust_your_api_key"
# Set the active drive
curl -X PUT https://api.ag2trust.com/api/v1/connectors/1/drive \
-H "X-API-Key: cust_your_api_key" \
-H "Content-Type: application/json" \
-d '{"drive_id": "abc123", "drive_name": "Engineering"}'
Step 4: Browse and Select a Folder¶
# Browse folders (root level)
curl "https://api.ag2trust.com/api/v1/connectors/1/drive/folders?parent_id=root" \
-H "X-API-Key: cust_your_api_key"
# Set the target folder
curl -X PUT https://api.ag2trust.com/api/v1/connectors/1/folder \
-H "X-API-Key: cust_your_api_key" \
-H "Content-Type: application/json" \
-d '{"folder_id": "folder123", "folder_name": "Product Docs"}'
Step 5: Preview and Import¶
# Preview files in the selected folder
curl "https://api.ag2trust.com/api/v1/connectors/1/drive/preview?folder_id=folder123" \
-H "X-API-Key: cust_your_api_key"
# Trigger import
curl -X POST https://api.ag2trust.com/api/v1/connectors/1/import \
-H "X-API-Key: cust_your_api_key"
Step 6: Check Import Status¶
Managing Connectors¶
Disconnect a Connector¶
Revokes OAuth tokens and marks the connector as disconnected. Imported documents remain in your knowledge base.
curl -X POST https://api.ag2trust.com/api/v1/connectors/1/disconnect \
-H "X-API-Key: cust_your_api_key"
Delete a Connector¶
Removes the connector and all imported documents.
API Reference¶
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/connectors | List connectors |
GET | /api/v1/connectors/{id} | Get connector details |
DELETE | /api/v1/connectors/{id} | Delete connector + imported docs |
POST | /api/v1/connectors/{id}/disconnect | Revoke OAuth, keep docs |
GET | /api/v1/connectors/{id}/drives | List SharePoint drives |
PUT | /api/v1/connectors/{id}/drive | Set active drive |
GET | /api/v1/connectors/{id}/drive/folders | Browse folders |
PUT | /api/v1/connectors/{id}/folder | Set target folder |
GET | /api/v1/connectors/{id}/drive/preview | Preview importable files |
POST | /api/v1/connectors/{id}/import | Trigger document import |
GET | /api/v1/connectors/{id}/import-status | Check import progress |
Best Practices¶
- Start with a specific folder — Importing an entire drive can consume your knowledge token budget quickly
- Monitor import status — Large folders may take several minutes to process
- Review imported documents — Check the Knowledge Base after import to verify documents processed correctly
- Use separate connectors per team — Attach connectors to specific team scopes for better organization
Troubleshooting¶
OAuth authorization fails¶
- Ensure your organization admin has granted consent for the Ag2Trust app
- For SharePoint, verify the Ag2Trust app has Sites.Read.All permission
Import stuck in "processing"¶
- Large files (near 10MB limit) may take longer to extract text
- Check individual document status in the Knowledge Base dashboard
Documents not appearing in agent context¶
- Verify documents have
status: ready(notpendingorfailed) - Confirm the documents are attached to the correct scope (org, team, or agent type)
Next Steps¶
- Knowledge Base — Document management and context configuration
- File Uploads & Downloads — Manual file uploads via API