---
title: "Adds files from SharePoint Online into a collection."
method: POST
path: "/ingest/sharepoint_online"
tags: ["Document Ingestion"]
---

# Adds files from SharePoint Online into a collection.

`POST /ingest/sharepoint_online`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/ingest/sharepoint_online`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/ingest/sharepoint_online/post.ts> (a function with typed inputs; its response is checked against the schema)

Adds files from Microsoft SharePoint Online into a collection. Accepts a
list of entries — sites, drives, folders, or files — each identified by
the drive_id and object_id returned by the connector browse API.

To ingest from a drive that is only addressable by its drive_id (for
example a OneDrive personal drive, a Microsoft 365 group drive, or any
drive in a non-discoverable site) pass an entry with
entry_type="drive_by_id" and the drive_id field set.

## Query parameters

- `collection_id` string, required
- `gen_doc_summaries` boolean
- `gen_doc_questions` boolean
- `audio_input_language` string
- `ocr_model` string
- `tesseract_lang` string
- `keep_tables_as_one_chunk` boolean
- `chunk_by_page` boolean
- `handwriting_check` boolean
- `ingest_mode` 'standard' | 'agent_only'
- `timeout` number, double

## Request body

- IngestFromSharepointOnlineBody
  - `entries` SharepointIngestionEntry[], required: Entries to ingest. Each entry is one of: a site (full subtree), a drive (full drive contents), a drive_by_id (a drive identified only by its drive_id), a directory, or a single file.
    - `name` string: Display name of the entry. Optional — used in logs.
    - `entry_type` 'site' | 'drive' | 'drive_by_id' | 'directory' | 'file', required
    - `web_url` string: Web URL of the entry. Optional — derived from drive_id/object_id when omitted.
    - `drive_id` string: SharePoint drive identifier.
    - `object_id` string: SharePoint site/folder/file identifier.
  - `credentials` SharepointOnlineCredentials, required: Credentials for SharePoint Online. Provide either the app-auth triple (tenant_name + client_id + client_secret) or the OAuth-user pair (user_id + optional connector_id). The auth_type field must match.
    - `auth_type` 'app' | 'user': "app" for application credentials, "user" for delegated OAuth.
    - `tenant_name` string: SharePoint tenant name (app auth only).
    - `client_id` string: Azure AD application client ID (app auth only).
    - `client_secret` string: Azure AD application client secret (app auth only).
    - `user_id` string: User ID owning the OAuth token (user auth only).
    - `connector_id` string: Optional connector ID when the user has more than one linked SharePoint connector.
    - `admin_enumerate_drives` boolean: App auth only. When true, discovery additionally enumerates every drive in the tenant via /drives. Requires Files.Read.All / Sites.Read.All on the application.
  - `metadata` object: Metadata for the documents.

## Response `204`

Successful operation

## Other responses

- `400`: Bad request
- `401`: Unauthorized - Invalid or missing API key
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
