Skip to main content

SharePoint List Resources

List resources from SharePoint for knowledge ingestion. This endpoint retrieves available SharePoint sites, drives, and folders that can be configured for content ingestion into the knowledge base.


Endpoint

Method: POST URL: {{base_url}}/v2/sharepoint/listing


Authentication

This endpoint uses Bearer Token authentication via a JWT (JSON Web Token). The token must be included in the Authorization header.


Headers

HeaderDescriptionRequired
AuthorizationBearer token (JWT) for authenticationYes
acceptSpecifies acceptable response formats (application/json)Yes
content-typeMust be application/jsonYes
x-tenantidUUID identifying the tenant/organizationYes

Path Parameters

None.


Query Parameters

None.


Request Body Schema

FieldTypeDescriptionRequired
authorizationobjectSharePoint authentication configurationYes
authorization.azure_tidstringMicrosoft Azure Tenant IDYes
authorization.client_idstringAzure App Registration Client IDYes
authorization.client_secretstringAzure App Registration Client SecretYes
authorization.thumbprintstringCertificate thumbprint (if using certificate auth)No
authorization.keystringCertificate private key (if using certificate auth)No
authorization.sharepoint_authbooleanWhether to use SharePoint-specific authenticationYes
site_urlsarrayList of SharePoint site URLs to queryNo
sub_sitesarrayList of sub-sites to includeNo
drivesarrayList of document library drives to queryNo
foldersarrayList of specific folders to queryNo
content_restrictionobjectContent access restrictionsNo
content_restriction.audiencearrayAudience filter (e.g., ["all"])No
blacklistedbooleanWhether to exclude blacklisted contentNo
source_restrictionbooleanWhether to apply source restrictionsNo

Request Body Example

{
"authorization": {
"azure_tid": "string",
"client_id": "string",
"client_secret": "string",
"thumbprint": "",
"key": "",
"sharepoint_auth": false
},
"site_urls": [],
"sub_sites": [],
"drives": [],
"folders": [],
"content_restriction": {
"audience": [
"all"
]
},
"blacklisted": false,
"source_restriction": false
}

List All Sites:

{
"authorization": {
"azure_tid": "{{azure_tenant_id}}",
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}",
"thumbprint": "",
"key": "",
"sharepoint_auth": false
},
"site_urls": [],
"sub_sites": [],
"drives": [],
"folders": [],
"content_restriction": {
"audience": [
"all"
]
},
"blacklisted": false,
"source_restriction": false
}

List Specific Site Resources:

{
"authorization": {
"azure_tid": "{{azure_tenant_id}}",
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}",
"thumbprint": "",
"key": "",
"sharepoint_auth": false
},
"site_urls": [
"https://contoso.sharepoint.com/sites/IT-Support",
"https://contoso.sharepoint.com/sites/HR-Policies"
],
"sub_sites": [],
"drives": [],
"folders": [],
"content_restriction": {
"audience": [
"all"
]
},
"blacklisted": false,
"source_restriction": false
}

With Certificate Authentication:

{
"authorization": {
"azure_tid": "{{azure_tenant_id}}",
"client_id": "{{client_id}}",
"client_secret": "",
"thumbprint": "{{certificate_thumbprint}}",
"key": "{{certificate_private_key}}",
"sharepoint_auth": false
},
"site_urls": [],
"sub_sites": [],
"drives": [],
"folders": [],
"content_restriction": {
"audience": [
"all"
]
},
"blacklisted": false,
"source_restriction": false
}

Example cURL

curl --request POST \
--url '{{base_url}}/v2/sharepoint/listing' \
--header 'accept: application/json' \
--header 'authorization: Bearer {{access_token}}' \
--header 'content-type: application/json' \
--header 'x-tenantid: {{tenant_id}}' \
--data '{
"authorization": {
"azure_tid": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"client_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"client_secret": "your-client-secret-here",
"thumbprint": "",
"key": "",
"sharepoint_auth": false
},
"site_urls": [],
"sub_sites": [],
"drives": [],
"folders": [],
"content_restriction": {
"audience": ["all"]
},
"blacklisted": false,
"source_restriction": false
}'

Success Response Example

Status Code: 200 OK

{
"success": true,
"data": {
"sites": [
{
"id": "contoso.sharepoint.com,1234-5678-abcd",
"name": "IT Support",
"url": "https://contoso.sharepoint.com/sites/IT-Support",
"drives": [
{
"id": "b!abc123",
"name": "Documents",
"driveType": "documentLibrary"
}
]
}
],
"total": 1
},
"timestamp": "2025-07-10T14:00:00.000Z"
}

Error Responses

Status CodeErrorDescription
400 Bad RequestInvalid request bodyMalformed JSON or missing required fields
401 UnauthorizedAuthentication failedBearer token is missing, expired, or invalid
403 ForbiddenInsufficient permissionsUser lacks permission or SharePoint access denied
422 Unprocessable EntityValidation errorInvalid field values or configuration
500 Internal Server ErrorServer errorUnexpected server-side error

Example Validation Error Response (422):

{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}

Example Error Response:

{
"detail": [
{
"loc": ["body", "authorization", "client_id"],
"msg": "field required",
"type": "value_error.missing"
}
]
}

Notes

  1. Azure App Registration: You must have an Azure App Registration with appropriate Microsoft Graph API permissions for SharePoint access.

  2. Required Permissions: The app registration typically needs:

    • Sites.Read.All or Sites.ReadWrite.All
    • Files.Read.All or Files.ReadWrite.All
  3. Authentication Methods:

    • Client Secret: Use client_secret for simpler setup
    • Certificate: Use thumbprint and key for enhanced security
  4. Azure Tenant ID: The azure_tid is your Microsoft Azure AD tenant ID.

  5. Empty Arrays: Pass empty arrays ([]) to list all available resources without filtering.

  6. Content Restrictions: Use content_restriction.audience to filter content by audience targeting.

  7. Blacklisting: When blacklisted is true, previously blacklisted content will be excluded.

  8. Source Restrictions: Enable source_restriction to apply configured source-level access controls.

  9. Related Endpoints:

    • POST /v2/sharepoint/ingest — Ingest SharePoint content
    • GET /v2/sharepoint/status — Check ingestion status
    • DELETE /v2/sharepoint/sources — Remove SharePoint sources