Skip to content

OneDrive / SharePoint

Integration with SharePoint/OneDrive via an n8n proxy. Allows browsing folder contents and importing files directly into notebooks for ingestion.

Base path: /api/onedrive


GET /api/onedrive/status

Check if the SharePoint/OneDrive integration is available. Returns connected: true when the n8n webhook API key is configured.

Auth: User

Headers:

Header Value
Authorization Bearer <token>

Status: 200 OK

{
  "success": true,
  "data": {
    "connected": true,
    "user_email": null,
    "provider": "sharepoint"
  }
}
Code Cause
401 Invalid or missing token
curl http://localhost:8000/api/onedrive/status \
  -H "Authorization: Bearer $TOKEN"
import httpx

response = httpx.get(
    "http://localhost:8000/api/onedrive/status",
    headers={"Authorization": f"Bearer {token}"},
)
status = response.json()["data"]
print(f"Connected: {status['connected']}")

GET /api/onedrive/folders

Browse the contents of a SharePoint/OneDrive folder via the n8n proxy. Returns files and subfolders. Only shows supported file types.

Auth: User

Headers:

Header Value
Authorization Bearer <token>

Query Parameters:

Parameter Type Required Default Description
folder_id string No "root" SharePoint folder ID or "root"

Status: 200 OK

{
  "success": true,
  "data": {
    "folder_id": "root",
    "folder_name": "Documents",
    "items": [
      {
        "id": "folder-abc",
        "name": "HR Documents",
        "type": "folder",
        "child_count": 12
      },
      {
        "id": "file-xyz",
        "name": "handbook.pdf",
        "type": "file",
        "size": 245760,
        "mime_type": "application/pdf"
      }
    ]
  }
}
Code Cause
400 Invalid folder ID or API error
401 Invalid or missing token
curl "http://localhost:8000/api/onedrive/folders?folder_id=root" \
  -H "Authorization: Bearer $TOKEN"
import httpx

response = httpx.get(
    "http://localhost:8000/api/onedrive/folders",
    headers={"Authorization": f"Bearer {token}"},
    params={"folder_id": "root"},
)
data = response.json()["data"]
for item in data["items"]:
    print(f"  [{item['type']}] {item['name']}")

POST /api/onedrive/import

Import selected files from SharePoint into a notebook. Downloads each file via the n8n proxy, uploads to storage, and triggers the standard ingestion pipeline in the background.

Auth: Admin

Headers:

Header Value
Authorization Bearer <token>
Content-Type application/json

Body:

{
  "notebook_id": "a1b2c3d4-...",
  "file_ids": ["file-xyz", "file-abc"],
  "notebook_name": "Customer Support KB",
  "settings": {
    "parser": "Docling Parser",
    "chunking_strategy": "Recursive Chunking"
  }
}
Field Type Required Default Description
notebook_id string Yes -- Target notebook
file_ids array Yes -- SharePoint file IDs to import
notebook_name string No -- Notebook name for metadata
settings object No null Ingestion settings

Status: 200 OK

{
  "success": true,
  "data": {
    "imported": [
      {
        "file_id": "f1a2b3c4-...",
        "file_name": "handbook.pdf",
        "storage_path": "nb/f1a2b3c4/handbook.pdf",
        "size": 245760
      }
    ],
    "jobs": [
      {
        "job_id": "j1a2b3c4-...",
        "file_id": "f1a2b3c4-..."
      }
    ],
    "skipped": []
  }
}
Code Cause
400 Invalid request or SharePoint API error
401 Invalid or missing token
403 Non-admin user
curl -X POST http://localhost:8000/api/onedrive/import \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "notebook_id": "a1b2c3d4",
    "file_ids": ["file-xyz"],
    "notebook_name": "Customer Support KB"
  }'
import httpx

response = httpx.post(
    "http://localhost:8000/api/onedrive/import",
    headers={"Authorization": f"Bearer {token}"},
    json={
        "notebook_id": "a1b2c3d4",
        "file_ids": ["file-xyz"],
        "notebook_name": "Customer Support KB",
        "settings": {"parser": "Docling Parser"},
    },
    timeout=60.0,
)
result = response.json()["data"]
print(f"Imported {len(result['imported'])} files")

POST /api/onedrive/import-folder

Import all supported files from a SharePoint folder. The n8n proxy lists all files, downloads each one, uploads to storage, and triggers ingestion.

Auth: Admin

Headers:

Header Value
Authorization Bearer <token>
Content-Type application/json

Body:

{
  "notebook_id": "a1b2c3d4-...",
  "folder_id": "folder-abc",
  "notebook_name": "Customer Support KB",
  "settings": {
    "parser": "Docling Parser"
  }
}
Field Type Required Default Description
notebook_id string Yes -- Target notebook
folder_id string Yes -- SharePoint folder ID
notebook_name string No -- Notebook name for metadata
settings object No null Ingestion settings

Status: 200 OK

{
  "success": true,
  "data": {
    "imported": [
      {
        "file_id": "f1a2b3c4-...",
        "file_name": "handbook.pdf",
        "storage_path": "nb/f1a2b3c4/handbook.pdf"
      }
    ],
    "jobs": [
      {"job_id": "j1a2b3c4-...", "file_id": "f1a2b3c4-..."}
    ],
    "skipped": []
  }
}
Code Cause
400 Invalid folder ID or SharePoint API error
401 Invalid or missing token
403 Non-admin user
curl -X POST http://localhost:8000/api/onedrive/import-folder \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "notebook_id": "a1b2c3d4",
    "folder_id": "folder-abc",
    "notebook_name": "Customer Support KB"
  }'
import httpx

response = httpx.post(
    "http://localhost:8000/api/onedrive/import-folder",
    headers={"Authorization": f"Bearer {token}"},
    json={
        "notebook_id": "a1b2c3d4",
        "folder_id": "folder-abc",
        "notebook_name": "Customer Support KB",
    },
    timeout=120.0,
)
result = response.json()["data"]
print(f"Imported {len(result['imported'])} files from folder")

DELETE /api/onedrive/disconnect

Disconnect the OneDrive/SharePoint integration. With the n8n proxy approach this is a no-op since auth is managed by the n8n server.

Auth: User

Headers:

Header Value
Authorization Bearer <token>

Status: 200 OK

{
  "success": true,
  "data": {
    "disconnected": true
  }
}
Code Cause
401 Invalid or missing token
curl -X DELETE http://localhost:8000/api/onedrive/disconnect \
  -H "Authorization: Bearer $TOKEN"
import httpx

response = httpx.delete(
    "http://localhost:8000/api/onedrive/disconnect",
    headers={"Authorization": f"Bearer {token}"},
)
print(response.json()["data"])