---
title: "修改数据源同步配置"
method: PATCH
path: "/datasource/{id}/sync-settings"
tags: ["DataSource"]
---

# 修改数据源同步配置

`PATCH /datasource/{id}/sync-settings`

## Request

- Base URL: `/api/v1` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/datasource/{id}/sync-settings`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `X-API-Key`

## Path parameters

- `id` string, required

## Request body

- InternalHandlerPatchDataSourceSyncRequest
  - `conflict_strategy` 'overwrite' | 'skip': Overwrite existing content or skip conflicts.
  - `resource_ids` string[]: Replaces the complete selection. Get IDs from data_source.list_resources; never infer them from names.
  - `sync_deletions` boolean: Whether future syncs delete documents that were removed upstream.
  - `sync_mode` 'incremental' | 'full': Incremental sync or a full scan.
  - `sync_schedule` string: Six-field cron including seconds, optionally prefixed with CRON_TZ=Area/City. Empty disables scheduled sync.

## Response `200`

OK

- GithubComTencentWeKnoraInternalHandlerDtoDataSourceResponse
  - `config` GithubComTencentWeKnoraInternalHandlerDtoDataSourceConfigDTO
    - `resource_ids` string[]
    - `settings` object
    - `type` string
  - `conflict_strategy` string
  - `created_at` string
  - `credentials` object: Single logical credential field — DataSource credentials are a per-connector atomic map, so "configured?" applies to the whole set.
  - `error_message` string
  - `id` string
  - `knowledge_base_id` string
  - `last_sync_at` string
  - `last_sync_cursor` object
  - `last_sync_result` object
  - `latest_sync_log` GithubComTencentWeKnoraInternalTypesSyncLog
    - `created_at` string: Creation timestamp (usually same as StartedAt)
    - `data_source_id` string: Reference to the data source
    - `error_message` string: Error details if status is "failed"
    - `finished_at` string: Sync completion time
    - `id` string: Unique identifier
    - `items_created` integer: New items created in knowledge base
    - `items_deleted` integer: Items deleted from knowledge base
    - `items_failed` integer: Items that failed to sync
    - `items_skipped` integer: Items skipped (no changes detected)
    - `items_total` integer: Total items fetched from source
    - `items_updated` integer: Existing items updated
    - `result` object: Detailed sync result (JSON-encoded)
    - `started_at` string: Sync start time
    - `status` string: Sync status: running, success, partial, failed, canceled
    - `tenant_id` integer: Workspace ID
    - `updated_at` string: Last update timestamp
  - `name` string
  - `status` string
  - `sync_deletions` boolean
  - `sync_log_retention_days` integer
  - `sync_mode` string
  - `sync_schedule` string
  - `tenant_id` integer
  - `total_items_synced` integer
  - `type` string
  - `updated_at` string

## Changes

- **2026-10-17** `de9fb40c7476`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/datasource/:id/sync-settings/patch.md)

---

[API](https://skmtc.dev/tencentblueking/apis/weknora-api.md) - [All operations](https://skmtc.dev/tencentblueking/apis/weknora-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tencentblueking/apis/weknora-api/revisions/685d1f9fce30?raw)
