# Manage segments and processing tasks

Create, update, enable, switch, or delete segments in knowledge-base data sources, and query, reconcile, and reprocess data-processing tasks. This page does not add data sources or maintain semantic entries.

## Prerequisites

Prepare credentials that can access the target workspace and IDs for the target knowledge base and data source. For service endpoints, authentication, and general request formats, see [Prepare to call an API](../../api-call-basics.md).

Before starting, confirm that the data source was added to the knowledge base. The specific input needed for segments, versions, and processing tasks is defined by the corresponding action pages.

## Call sequence

1. First [list data-processing tasks](../../../../reference/api/ai-studio/resource-center/knowledge-bases/list-data-processing-jobs.md) to understand processing tasks for the target data source.
2. To maintain content manually, create, import, or update segments, and retain segment or version IDs.
3. Use enable, disable, or switch-current-version actions to make a target segment version the currently usable version.
4. To reprocess data, submit a reconcile or re-vectorize action, then list processing tasks again to confirm the result.

## API operations

### Manage segments and versions

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Create a segment | [Create a segment](../../../../reference/api/ai-studio/resource-center/knowledge-bases/create-segment.md) | You identified the data source and segment content. |
| Import initial segments | [Import initial segments](../../../../reference/api/ai-studio/resource-center/knowledge-bases/import-initial-segments.md) | Import a set of initial segments. |
| Update a segment | [Update a segment](../../../../reference/api/ai-studio/resource-center/knowledge-bases/update-segment.md) | You have a target segment ID and need to modify content or configuration. |
| Enable or disable a segment | [Enable or disable a segment](../../../../reference/api/ai-studio/resource-center/knowledge-bases/set-segment-enabled.md) | Change whether a segment participates in current use. |
| Switch the current segment version | [Set the current segment version](../../../../reference/api/ai-studio/resource-center/knowledge-bases/set-current-segment-version.md) | Specify the segment version currently in use. |
| Delete a segment | [Delete a segment](../../../../reference/api/ai-studio/resource-center/knowledge-bases/delete-segment.md) | Confirm impact and conditions on the action page before deletion. |

### Process and reprocess data

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Query data-processing tasks | [List data-processing tasks](../../../../reference/api/ai-studio/resource-center/knowledge-bases/list-data-processing-jobs.md) | View processing tasks and confirm later results. |
| Reconcile data-processing tasks | [Reconcile processing task status](../../../../reference/api/ai-studio/resource-center/knowledge-bases/reconcile-data-processing-jobs.md) | Reconcile processing tasks for a target data source. |
| Re-vectorize data | [Re-vectorize a data source](../../../../reference/api/ai-studio/resource-center/knowledge-bases/revectorize-data-source.md) | Re-vectorize the target data source. |

## Confirm the result

After submitting a reconcile or re-vectorize action, use [List data-processing tasks](../../../../reference/api/ai-studio/resource-center/knowledge-bases/list-data-processing-jobs.md) to view the target task. After segment changes, use the result instructions on the corresponding action page to confirm the current version and enabled state.

## Limitations and notes

Deleting or disabling a segment, or switching the current version, changes segment results used later. Confirm impact and conditions on the corresponding action page before proceeding.

## Next steps

- [Manage data sources and documents](data-sources-documents.md)
- [Manage semantic entries](semantic-entries.md)
