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

# Creates a job to add files from SharePoint Online into a collection.

`POST /ingest/sharepoint_online/job`

## Request

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

Creates a job to add files from Microsoft SharePoint Online into a
collection. See ingest_from_sharepoint_online for details on the entry
shape — including how to target a drive by its drive_id.

## 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 `201`

Successful operation

- JobDetails
  - `id` string, required
  - `name` string, required
  - `overall_status` 'in progress' | 'completed' | 'failed' | 'canceled', required
  - `status` string
  - `passed_percentage` number, double, required
  - `failed_percentage` number, double, required
  - `progress` number, double, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `kind` string, required
  - `statuses` JobDetailsStatus[], required
    - `id` string, required
    - `status` string, required
  - `errors` string[], required
  - `duration` string, required
  - `duration_seconds` number, double, required
  - `canceled_by` string
  - `cancel_reason` string
  - `timeout` number, double
  - `start_time` number, double
  - `files_total` integer
  - `files_failed` integer

## 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)
